Code covered by the BSD License  

Highlights from
MATLAB for Digital Communication

image thumbnail

MATLAB for Digital Communication


Won Yang (view profile)


The MATLAB programs in "MATLAB/Simulink for Digital Communication" authored by Won Y. Yang et. al

%dc040e03.m  for Example 4.3 (Non-uniform Quantization of sin t)
clear, clf
t=[0:0.05:7]; x=sin(t);
b0=-1; bN=1; xmax=max(abs([b0 bN]))
N=16; delta=(bN-b0)/N; % Width of the quantization interval
b=b0+[0:N]*delta; % Boundary vector
c=b(1:N)+delta/2; % Midpoint vector
x_q16=adc(x,b,c); % Uniform quantization
xn_q16=adc(x,bn,cn); % Non-uniform quantization
subplot(311), plot(t,x,'k', t,x_q16,'b:', t,xn_q16,'r-')
e=x-x_q16;  en=x-xn_q16; % Absolute error
subplot(312), plot(t,e,'b:', t,en,'r-')
tmp= abs(x)+0.01; re=e./tmp;  ren=en./tmp; % Relative error
subplot(313), plot(t,re,'b:', t,ren,'r-')

Contact us