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;
weixin_42653672
- 粉丝: 109
- 资源: 1万+
最新资源
- IMG_20241019_203801_edit_288242973348204.jpg
- 基于Flink+Kafka的全链路数仓, 包括实时和离线详细文档+全部资料.zip
- 基于Flink的电商实时数据仓库项目详细文档+全部资料.zip
- 基于flink的电商实时数据分析、推荐、风控项目详细文档+全部资料.zip
- 华盈恒信—福建金辉房地产—1104培训体系研讨问题.doc
- 华盈恒信—福建金辉房地产—培训管理办法1116.doc
- 华盈恒信—福建金辉房地产—南国金辉售楼部培训考核问卷.doc
- 华盈恒信—福建金辉房地产—例:2001年应届毕业生进厂培训、实习计划.doc
- 基于Flink的车联网实时数据平台详细文档+全部资料.zip
- 基于Flink的练习项目详细文档+全部资料.zip
- 华盈恒信—金德精密—员工培训课程大纲.doc
- 基于Flink的批流处理实战案例详细文档+全部资料.zip
- 联纵智达-钱江啤酒—徐鹭钱啤区域经理培训纲要.doc
- 基于Flink的电影数据实时统计网站详细文档+全部资料.zip
- 基于flink的实时计算平台详细文档+全部资料.zip
- 基于flink的实时流计算web平台详细文档+全部资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0