function [interv,values,probs]=lloyd_max(N)
%function y=lloyd_max(N)
%Iteratively obtains the optimum (Lloyd-Max)
%quantizer for a normally distributed source
%(unit variance) and outputs the optimum quantization levels
%in vector "interv" and the optimum
%quantization values in vector "values".
%N is the number of bits of quantization.
%It makes use of the fact that the density is symmetric
%around zero and only quantizes the positive axis. For the
%negative axis, the quantization intervals and values are
%the negatives of the ones obtained.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Program written for EE 455 by C. Georghiades, Sept. 20, 1998%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Compute the number of quantization levels, L:
L=2^N;
%V below is just an initial range and it can be set to any reasonable value.
V=2030;
%Define initial quantization intervals (uniformly distributed)
%teste
a=linspace(0,V,L/2);
a=[a,0];
%teste
%Start the iteration for the Lloyd-Max optimum quantizer:
%Use enough the norm of the error for xhat to determine convergence
xhat_old=zeros(1,L/2);
error=1;
while(error>1.0e-6)
%Compute the conditional mean estimates, xhat, corresponding to a
%(it calls function gauss_distr() which returns the distribution
%function of a normal variable):
b=gauss_distr(a);
c=b(2:length(b))-b(1:length(b)-1);
cm=(exp(-a(1:length(a)-1).^2/2)-exp(-a(2:length(a)).^2/2))/sqrt(2*pi);
xhat=cm./c;
error=norm(xhat-xhat_old);
xhat_old=xhat;
%Now update a using ai=(xhat_i+xhat_(i+1))/2:
a1=(xhat(2:length(xhat))+xhat(1:length(xhat)-1))/2;
%Append the boundaries of the quantization interval
a=[0,a1,Inf];
end
interv=a;
values=xhat;
probs=c;
没有合适的资源?快使用搜索试试~ 我知道了~
lloyd_max.zip_ lloyd_max_Lloyd_it_lloyd max quantizer_max dct
共2个文件
m:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 79 浏览量
2022-07-15
09:19:11
上传
评论
收藏 1KB ZIP 举报
温馨提示
dct- computes de discrete cosine transform for a matriz 8*8 from a picture.It receaves the point of the block where begin calculate, the tam of the block and the original picture... lLoyd-max- computes de lLoyd-max optimum quantizer for N bits.
资源详情
资源评论
资源推荐
收起资源包目录
lloyd_max.zip (2个子文件)
DCT.m 922B
lloyd_max.m 2KB
共 2 条
- 1
weixin_42653672
- 粉丝: 107
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0