⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lloydmax.m

📁 contemporarycommunicatonsystem-using MATLAB经典书目源程序!
💻 M
字号:
function [a,y,dist]=lloydmax(funfcn,b,n,tol,p1,p2,p3)%LLOYDMAX 	Returns the the Lloyd-Max quantizer and the mean-squared %	  	quantization error for a symmetric distribution.%         	[A,Y,DIST]=LLOYDMAX(FUNFCN,B,N,TOL,P1,P2,P3)     % 	  	funfcn=The density function given %	  	in an m-file. It can depent on up to three %	  	parameters, p1,p2,p3.% 	  	a=The vector giving the boundaries of the %	  	quantization regions. %	  	[-b,b] approximates support of the density function.%	  	n=The number of quantization regions.%	  	y=The quantization levels.% 	  	p1,p2,p3=Parameters of funfcn.%	  	tol=the relative error.args=[];for j=1:nargin-4  args=[args,',p',int2str(j)];endargs=[args,')'];v=eval(['variance(funfcn,-b,b,tol',args]);a(1)=-b;d=2*b/n;for i=2:n  a(i)=a(i-1)+d;enda(n+1)=b;dist=v;[y,newdist]=eval(['mse_dist(funfcn,a,tol',args]);while(newdist<0.99*dist),  for i=2:n    a(i)=(y(i-1)+y(i))/2;  end  dist=newdist;  [y,newdist]=eval(['mse_dist(funfcn,a,tol',args]);end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -