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

📄 uq_mdpnt.m

📁 现代通信系统(matlab版)(第二版)配套源代码 John G. Proakis等著 刘树棠 译 电子工业出版社出版
💻 M
字号:
function dist=uq_mdpnt(funfcn,b,n,delta,tol,p1,p2,p3)
%UQ_MDPNT 	returns the distortion of a uniform quantizer
% 	  	with quantization points set to the midpoints
%	  	DIST=UQ_MDPNT(FUNFCN,B,N,DELTA,TOL,P1,P2,P3).
%	  	funfcn=source density function given in an m-file 
%	  	with at most three parameters, p1,p2,p3. The density
%	  	function is assumed to be an even function.
%	  	[-b,b]=the support of the source density function.
%	  	n=number of levels.
% 	  	delta=level size.
% 	  	p1,p2,p3=parameters of the input function.
%	  	dist=distortion.
%	  	tol=the relative error.

if (2*b<delta*(n-1))
  error('Too many levels for this range.'); return
end
args=[];
for j=1:nargin-5
  args=[args,',p',int2str(j)];
end
args=[args,')'];
a(1)=-b;
a(n+1)=b;
a(2)=-(n/2-1)*delta;
y(1)=a(2)-delta/2;
for i=3:n
  a(i)=a(i-1)+delta;
  y(i-1)=a(i)-delta/2;
end
y(n)=a(n)+delta;
dist=0;
for i=1:n
  newfun = 'x_a2_fnct' ;
  dist=dist+eval(['quad(newfun,a(i),a(i+1),tol,[],funfcn,', num2str(y(i)), args]);
end

⌨️ 快捷键说明

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