frequency.m
资源名称:work.rar [点击查看]
上传用户:hwtw888
上传日期:2016-03-15
资源大小:177k
文件大小:0k
源码类别:
压缩解压
开发平台:
Matlab
- function f = frequency(vector)
- %函数frequency计算各符号出现的概率
- if ~isa(vector, 'uint8')
- error('input argument must be a uint8 vector');
- end
- f = repmat(0, 1, 256);
- len = length(vector);
- for index = 0:255
- f(index+1) = sum(vector == uint8(index));
- end
- f = f./len; %归一化