Interpolated FIR filter design
[h,g] = ifir(l,type,f,dev)
[h,g,d] = ifir(l,type,f,dev)
[...] = ifir(...,str)
[h,g] = ifir(l,type,f,dev) designs
a periodic filter
l is the interpolation factor. It also finds
an image-suppressor filter
g(z), such that the
cascade of the two filters represents the optimal minimax FIR approximation
of the desired response. This response is specified by
with band edge frequencies contained in vector
This is done while not exceeding the maximum deviations or ripples
(linear) specified in vector
type is set to
the filter design is a lowpass design. When
'high', the filter design is a highpass
f is a two-element vector with passband
and stopband edge frequency values. For narrowband lowpass filters
and wideband highpass filters,
l×f(2) is less
1. For wideband lowpass filters and narrowband
highpass filters, specify
f so that
dev is a two-element vector that contains
the peak ripple or deviation (in linear units) allowed for both the
passband and the stopband.
ifir design algorithm achieves an efficient
design in the sense that it reduces the total number of multipliers
required. To do this, the design problem is broken into two stages.
In the first stage, the filter is upsampled to achieve the stringent
specifications without using many multipliers. In the second stage,
the filter removes the images created when upsampling the previous
[h,g,d] = ifir(l,type,f,dev) returns
d that is connected in parallel with the
both wideband lowpass and highpass filters. This is necessary to obtain
the desired response.
[...] = ifir(...,str) uses
choose the algorithm level of optimization used. Possible values for
for a tradeoff between design speed and filter order optimization.
'advanced' option can result in substantial
filter order reduction, especially for
Narrowband lowpass design using an interpolation factor of 6
This example shows how to use the function
ifir to design a narrowband lowpass filter.
[h,g] = ifir(6,'low',[.12 .14],[.01 .001]); H = dsp.FIRFilter('Numerator',h); G = dsp.FIRFilter('Numerator',g); hfv = fvtool(H,G); legend(hfv,'Periodic Filter','Image Suppressor Filter')
Hcas = cascade(H,G); hfv2 = fvtool(Hcas); legend(hfv2,'Overall Filter')
Wideband highpass design using an interpolation factor of 6
This example shows how to use
ifir to design a wideband highpass filter.
[h,g,d]=ifir(6,'high',[.12 .14],[.001 .01]); H = dsp.FIRFilter('Numerator',h); G = dsp.FIRFilter('Numerator',g); b1 = cascade(H,G); % Branch 1 b2 = dsp.FIRFilter('Numerator',d); % Branch 2 Hoverall = freqz(b1) + freqz(b2); % Overall wideband highpass plot(linspace(0,1,length(Hoverall)),20*log10(abs(Hoverall))) xlabel('Normalized frequency (\times \pi) rad/s') ylabel('Magnitude (dB)') title('Overall Filter'); grid on
Design a cascade of lowpass filters
This example shows how to use
fdesign.lowpass to design a cascade of lowpass filters. After designing the filter, use
fvtool to plot the response curve.
fpass = 0.2; fstop = 0.24; d1 = fdesign.lowpass(fpass, fstop); lowpassCascade = design(d1,'ifir','Systemobject',true); fvtool(lowpassCascade)
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
All inputs must be constant. Expressions or variables are allowed if their values do not change.