FIR Digital Filter Design
The Window Method
Bandpass Filter Design Example
Matlab codeSearch Spectral Audio Signal Processing
Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?
The following Matlab code computes the optimal Chebyshev FIR bandpass filter:
M = 101; %normF = [0 0.3 0.4 0.6 0.8 1.0]; % transition bands different normF = [0 0.3 0.4 0.6 0.7 1.0]; % transition bands the same amp = [0 0 1 1 0 0]; % desired amplitude in each band [b2,err2] = remez(M-1,normF,amp); % optimal filter of length M % REMEZ Parks-McClellan optimal equiripple FIR filter design. % B=REMEZ(N,F,A) returns a length N+1 linear phase (real, symmetric % coefficients) FIR filter which has the best approximation to the % desired frequency response described by F and A in the minimax % sense. ... REMEZ treats the bands between F(k+1) and F(k+2) for odd % k as "transition bands" or "don't care" regions. figure(2); [H2,freq]=freqz(b2,[1],512); subplot(2,1,1); plot(freq*10000/pi,20*log10(abs(H2))); grid; xlabel('Hz'); ylabel('dB'); axis([0 10000 -110 30]); subplot(2,1,2); plot(freq*10000/pi,20*log10(abs(H2))); grid; xlabel('Hz'); ylabel('dB'); axis([3500 7000 -0.02 0.02]);
