File: filter_response.m

package info (click to toggle)
ptpd 2.3.1-debian1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, trixie
  • size: 4,420 kB
  • sloc: ansic: 22,012; sh: 11,581; makefile: 122; sed: 12
file content (29 lines) | stat: -rwxr-xr-x 478 bytes parent folder | download | duplicates (5)
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;