Professional Documents
Culture Documents
ZeroDiagrams,BIBOStabilityandQuantizationEffects
Présenté à Dr Lise Safatly
Préparé par Christina Hachem
Exercice 1:
a. function y = diffeqn(a,x,yn1)
N = length(x);
y(1)=a*yn1+x(1);
for i=2:N
y(i)=a*y(i-1)+x(i);
end
end
b. >>a=1;
>> yn1=0;
>> y1=diffeqn(a,x1,yn1);
>>stem(y1);
>> ylabel('y1');
>> xlabel('n');
>> title('the response due to the unit impulse’);
>> x2=ones(1,31);
>> y2=diffeqn(a,x2,y1);
>> stem(y2);
>> ylabel('y2')
>> xlabel('n')
c. >> yn1=-1;
>> x1=ones(1,31);
>>y1=diffeqn(a,x1,yn1);
>>x2=2*x1;
>>y2=diffeqn(a,x2,yn1);
>>stem(2*y1-y2);
>>ylabel('2*y1-y2');
>>xlabel('n');
>>x=ones(1,31)
>>yn1=0;
>>y1=diffeqn(a,x,yn1);
>>subplot(2,1,1);
>>stem(y1);
>>ylabel('y1');
>>xlabel('n');
>>yn2=0.5;
>> y2=diffeqn(a,x,yn2);
>>subplot(2,1,2);
>> stem(y2);
>> ylabel('y2(n)’);
>> xlabel('n');
Exercice 2 :
a. >> b1=[1 -1 0]
>> dpzplot(b1,a1);
>> xlabel('Re');
>> ylabel('Im');
Not stable.
b. >>b2=1;
>> xlabel('Re');
>> ylabel('Im');
Stable.
c. >>b3=[1 0.5];
>>dpzplot(b3,a3);
>>ylabel('Im');
Stable.
Exercice 3:
>>[H,w] = freqz(b,a,4096);
>> plot(w/pi,20*log10(abs(H)));
>> xlabel('frequency');
>> ylabel('|H(w)|(dB)');
>>h=filter(b,a,x);
>>plot(h(1:200));
>>title('Impulse response of the filter without quantization (a,b)');
>>xlabel('frequency');
>>ylabel('|H(w)|');
>>a16=quant(a,16,M);
>>b16=quant(b,16,M);
>>[H16,w] = freqz(b16,a16,4096);
>>plot(w/pi,20*log10(abs(H16)));
>>xlabel('frequency');
>>ylabel('|H(w)|');
The quantization of the coefficients has affected the frequency response.
c. >>dpzplot(b16,a16);
>>xlabel('Re');
>>ylabel('Im');
Stable since all the poles are inside the unity circle.
d. >>a12=quant(a,12,M);
>>b12=quant(b,12,M);
>>[H12,w] = freqz(b12,a12,4096);
>>plot(w/pi,20*log10(abs(H12)));
>>xlabel('frequency');
>>ylabel('|H(w)|');
>> dpzplot(b12,a12);
>>ylabel('Im(z)');
>> dpzplot(b,a);
>>xlabel('Re(z)');
>>ylabel('Im(z)');
Stable.
e. >> h12=filter(b12,a12,x);
>>plot(h12(1:200));
>>xlabel('frequency');
The response diverges so the filter is not stable.