I am currently using a MATLAB example on generating a Kaiser window finite impulse response (FIR) filter according to pre-determined filter requirements.
Kaiser Window Filter Design
Design a lowpass filter with passband defined from 0 to 1 kHz and stopband defined from 1500 Hz to 4 kHz. Specify a passband ripple of 5% and a stopband attenuation of 40 dB.
fsamp = 8000;
fcuts = [1000 1500];
mags = [1 0];
devs = [0.05 0.01];
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,fsamp);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
freqz(hh)
In my case, I'm expecting at least 40dB of signal attenuation by the time we hit the 4kHz mark in the frequency spectrum (ie: end of the transition band, beginning of the stop band). However, I have an additional requirement: that the filter also provides at least 20dB of attenuation by the mid-way point of the transition band (i: the 1250Hz mark). The filter I designed with the code above does not achieve both requirements, because the Kaiser FIR implementation has a slow initial roll-off.
Is there a direct method for forcing multiple constraints on the filter from the get-go, ie:
Design a lowpass filter with passband defined from 0 to 1 kHz and stopband defined from 1500 Hz to 4 kHz. Specify a passband ripple of 5% and a stopband attenuation of 40 dB, and at least 20dB attenuation by 1250Hz.
So far, the only such solution that comes to mind is to generate the same Kaiser window as I do above (once), but then loop through multiple iterations and increment the filter order, n, each iteration until my requirements are satisfied. Is there a more elaborate or direct method, or is my iterative approach the only approach at this time?
I tried just making a filter with 20dB attenuation by 1250Hz, but then the filter doesn't seem to provide much more attenuation further on (ie: only 22dB stopband attenuation by 1500Hz).
Thanks!

