Contents
2nd order system
b = [1 2 1]; a = [1 -1.4 .74];
ssr = ssr_mron(b,a);
Simulation parameter
N = 1e6;
w = 8;
rand('state',0);
x = 2*rand(1,N)-1;
x = x*sqrt(3)/5;
xq = quant2c(x,w,'r');
Filtering and analysis
[y,S] = ssr_filter(ssr,xq);
[yq,Sq,OC] = ssr_filter2c(ssr,xq,w);
fprintf('lab6_2 (%s)\n',ssr.form)
fprintf('Wordlength : %g bit\n',w)
fprintf('Overflow counter : %g\n',OC)
Ni = var(y-yq);
fprintf('Variance %g dB\n',10*log10(Ni))
FIG = figure('Name',['lab6_2 : Output signal (',ssr.form,')'],...
'NumberTitle','off','Units','normal','Position',[.3 .3 .65 .55]);
plot(0:200,y(1:201),':',0:200,y(1:201),'+',0:200,yq(1:201),'o'), grid
axis([0 200 -.6 .6]);
xlabel('n \rightarrow'), ylabel('y[n], y_q[n] \rightarrow')
legend('MATLAB','MATLAB',['quantized, w = ',num2str(w),' bit'],'Location','Best')
title(['Output signal (',ssr.form,')'])
lab6_2 (MNF)
Wordlength : 8 bit
Overflow counter : 0
Variance -46.3756 dB