====== Octave Filter Design Example ====== # do this one time pkg install control-3.1.0.tar.gz pkg install signal-1.4.0.tar.gz pkg list pkg update === Filter design === pkg load signal % Simple but has a large transition band and only about 50 to 60 db attenuation freqz(fir1(63,0.125)) The parks McClellan algorithm incorporates both the Remez exchange algorithm and the Chebyshev approximation theorem to achieve an optimal fit between your desired and actual filter response. % --- Parks-McClellan lowpass Filter n = 64 f = [0.0 0.3 0.4 1.0 ]; a = [1.0 1.0 0.0 0.0]; w = [1.0 0.1]; b = remez(n, f, a, w); [h,w] = freqz(b,1,512); plot(f,a,w/pi,abs(h)) legend('Ideal','remez Design') xlabel 'Radian Frequency (\omega/\pi)', ylabel 'Magnitude' === Example of 100dB filter === % example of 100dB filter f = [0.0 0.1 0.2 1.0 ]; a = [1.0 1.0 0.0 0.0]; freqz(remez(128,f,a)); {{:ref:octave:remez_100db.png|}}