| Filter Design Toolbox | ![]() |
Design interpolated FIR filters
Syntax
Description
h = ifir(l,type,f,dev)
finds a periodic filter
and an image-suppressor filter G(z) such that
l is the interpolation factor.
h represents the optimal minimax FIR approximation to the desired response specified by the string type. Specify the filter band edge frequencies in vector f. With ifir, you designs a filter that meets the response defined by type which does not exceed the peak ripple specified in vector dev.
type must be a string with either 'low' to generate lowpass filters or 'high' for highpass filters. f must be a two-element vector containing two values -- the first defining the passband edge frequency and the second that defines the stopband edge frequency. Vector dev must contain two values that specify the peak ripple or deviation allowed in the passband and stopband.
h = ifir(l,type,f,dev,str)
uses the string specified in str to select the degree of optimization the interpolation algorithm uses. str can be one of three allowed strings:
| str String Value |
Description |
'simple' |
|
'intermediate' |
|
'advanced' |
str lets you direct the filter design algorithm to trade between the time it takes to design the filter and optimizing the filter order. The 'advanced' option can substantially reduce the filter order, especially for g(z).
Examples
The first example creates a lowpass filter using ifir with an interpolation factor of 6. In example 2, the code designs a wideband highpass filter with the same interpolation factor. You can see the plots of the examples after the code sections.
Create a narrowband lowpass design using an interpolation factor of 6.
[h,g]=ifir(6,'low',[.12 .14],[.01 .001]); [Hh,w]=freqz(h,1,1024); Hg=freqz(g,1,1024); H = Hh.*Hg; % Compounded response subplot(2,1,1), freqzplot([Hh,Hg],w,'mag'); legend('Periodic Filter','Image Suppressor Filter'); subplot(2,1,2), freqzplot(H,w,'mag'); legend('Overall Filter');
Use the 'high' option to create a wideband highpass design using an interpolation factor of 6.
[h,g,d]=ifir(6,'high',[.12 .14],[.001 .01]); [Hh,w]=freqz(h,1,1024); Hg=freqz(g,1,1024); H = Hh.*Hg; % Branch 1 compounded response Hd = freqz(d,1,1024); % Branch 2 response Hoverall = H+Hd; freqzplot(Hoverall,w,'mag'); title('Overall Filter');
| ifft | iirbpc2bpc | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |