📄 uq_mdpnt.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.'); returnendargs=[];for j=1:nargin-5 args=[args,',p',int2str(j)];endargs=[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;endy(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 + -