1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#!/usr/bin/octave -qf
# the IIR filter
s = 2^4;
a = [ s -(s-1) ];
b = [ 1/2 1/2 ];
[h w] = freqz(b, a, 100000);
subplot(211);
plot(w/pi,abs(h),";;");
axis();
#plot(w/pi,20*log(abs(h)));
#axis([0 1 -120 0]);
#semilogx(w/pi,20*log(abs(h)),";;");
#axis([1e-3 1 -120 0]);
ylabel("gain");
subplot(212);
plot(w/pi,unwrap(angle(h)),";;");
axis([0 1 -pi 0]);
#semilogx(w/pi,unwrap(angle(h)),";;");
#axis([1e-3 1 -pi 0]);
ylabel("phase (rad)");
xlabel("frequency");
replot;
pause;
|