comparison scripts/signal/freqz_plot.m @ 6746:a8105a726e68

[project @ 2007-06-19 08:18:34 by dbateman]
author dbateman
date Tue, 19 Jun 2007 08:18:34 +0000
parents 2110cc251779
children 93c65f2a5668
comparison
equal deleted inserted replaced
6745:ca6668e47518 6746:a8105a726e68
36 mag = 20 * log10 (abs (h)); 36 mag = 20 * log10 (abs (h));
37 phase = unwrap (arg (h)); 37 phase = unwrap (arg (h));
38 maxmag = max (mag); 38 maxmag = max (mag);
39 39
40 subplot (3, 1, 1); 40 subplot (3, 1, 1);
41 plot (w, mag, ";Pass band (dB);"); 41 plot (w, mag);
42 grid ("on"); 42 grid ("on");
43 legend("Pass band (dB)");
43 axis ([w(1), w(n), maxmag-3, maxmag], "labely"); 44 axis ([w(1), w(n), maxmag-3, maxmag], "labely");
44 45
45 subplot (3, 1, 2); 46 subplot (3, 1, 2);
46 plot (w, mag, ";Stop band (dB);"); 47 plot (w, mag);
47 grid ("on"); 48 grid ("on");
49 legend ("Stop band (dB)");
48 if (maxmag - min (mag) > 100) 50 if (maxmag - min (mag) > 100)
49 axis ([w(1), w(n), maxmag-100, maxmag], "labely"); 51 axis ([w(1), w(n), maxmag-100, maxmag], "labely");
50 else 52 else
51 axis ("autoy", "labely"); 53 axis ("autoy", "labely");
52 endif 54 endif
53 55
54 subplot (3, 1, 3); 56 subplot (3, 1, 3);
55 plot (w, phase*360/(2*pi), ";Phase (degrees);"); 57 plot (w, phase*360/(2*pi));
56 grid ("on"); 58 grid ("on");
59 legend ("Phase (degrees)");
57 xlabel ("Frequency"); 60 xlabel ("Frequency");
58 axis ([w(1), w(n)], "autoy", "label"); 61 axis ([w(1), w(n)], "autoy", "label");
59 62
60 endfunction 63 endfunction