uq_dist.m

来自「功率控制算法」· M 代码 · 共 36 行

M
36
字号
function [y,dist]=uq_dist(funfcn,b,c,n,delta,s,tol,p1,p2,p3)%UQ_DIST 	Returns the distortion of a uniform quantizer.% 	 	with quantization points set to the centroids.%	 	[Y,DIST]=UQ_DIST(FUNFCN,B,C,N,DELTA,S,TOL,P1,P2,P3)%	 	funfcn=source density function given in an m-file %	 	with at most three parameters, p1,p2,p3.%	 	[b,c]=The support of the source density function.%	 	n=number of levels.% 	 	delta=level size.%	 	s=the leftmost quantization region boundary.% 	 	p1,p2,p3=parameters of the input function.%	 	y=quantization levels.%	 	dist=distortion.%	 	tol=the relative error.if (c-b<delta*(n-2))  error('Too many levels for this range.'); returnendif (s<b)  error('The leftmost boundary too small.'); returnendif (s+(n-2)*delta>c)  error('The leftmost boundary too large.'); returnendargs=[];for j=1:nargin-7  args=[args,',p',int2str(j)];endargs=[args,')'];a(1)=b;for i=2:n  a(i)=s+(i-2)*delta;enda(n+1)=c;[y,dist]=eval(['mse_dist(funfcn,a,tol',args]);

⌨️ 快捷键说明

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