frequency.m
资源名称:huffman.rar [点击查看]
上传用户:xmsdbyfz
上传日期:2022-06-22
资源大小:2k
文件大小:0k
源码类别:
压缩解压
开发平台:
Matlab
- %函数frequency计算各符号出现的概率
- function f=frequency(vector)
- 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;