Arbitrary response magnitude filter specification object
D = fdesign.arbmag(SPEC,specvalue1,specvalue2,...)
D = fdesign.arbmag(specvalue1,specvalue2,specvalue3)
D = fdesign.arbmag(...,Fs)
'N,F,A' — Single band design (default)
'F,A,R' — Single band minimum order design *
'N,B,F,A' — Multiband design
'N,B,F,A,C' — Constrained multiband design *
'B,F,A,R' — Multiband minimum order design *
'Nb,Na,F,A' — Single band design *
'Nb,Na,B,F,A' — Multiband design *
The string entries are defined as follows:
A — Amplitude vector. Values in A define the filter amplitude at frequency points you specify in f, the frequency vector. If you use A, you must use F as well. Amplitude values must be real. For complex values designs, use fdesign.arbmagnphase.
B — Number of bands in the multiband filter
C — Constrained band flag. This enables you to constrain the passband ripple in your multiband design. You cannot constrain the passband ripple in all bands simultaneously.
F — Frequency vector. Frequency values in specified in F indicate locations where you provide specific filter response amplitudes. When you provide F, you must also provide A.
N — Filter order for FIR filters and the numerator and denominator orders for IIR filters.
Nb — Numerator order for IIR filters
Na — Denominator order for IIR filter designs
R — Ripple
By default, this method assumes that all frequency specifications are supplied in normalized frequency.
F and A are the input arguments you use to define the filter response desired. Each frequency value you specify in F must have a corresponding response value in A. The following table shows how F and A are related.
Define the frequency vector F as [0 0.25 0.3 0.4 0.5 0.6 0.7 0.75 1.0]
Define the response vector A as [1 1 0 0 0 0 0 1 1]
These specifications connect F and A as shown here:
F (Normalized Frequency)
A (Response Desired at F)
Different specifications can have different design methods available. Use designmethods to get a list of design methods available for a given specification string and filter specification object.
Use designopts to get a list of design options available for a filter specification object and a given design method. Enter help(D,METHOD) to get detailed help on the available design options for a given design method.
D = fdesign.arbmag(SPEC,specvalue1,specvalue2,...) initializes the specifications with specvalue1, specvalue2. Use get(D,'Description') for descriptions of the various specifications specvalue1, specvalue2, ... specvalueN.
D = fdesign.arbmag(specvalue1,specvalue2,specvalue3) uses the default specification string 'N,F,A', setting the filter order, filter frequency vector, and the amplitude vector to the values specvalue1, specvalue2, and specvalue3.
Use fdesign.arbmag to design a 3–band filter.
Use the given frequency and amplitude vectors in Specifying Frequency and Amplitude Vectors.
N = 150; B = 3; F = [0 .25 .3 .4 .5 .6 .7 .75 1]; A = [1 1 0 0 0 0 0 1 1]; A1 = A(1:2); A2 = A(3:7); A3 = A(8:end); F1 = F(1:2); F2 = F(3:7); F3 = F(8:end); d = fdesign.arbmag('N,B,F,A',N,B,F1,A1,F2,A2,F3,A3); Hd = design(d); fvtool(Hd)
A response with two passbands — one roughly between 0 and 0.25 and the second between 0.75 and 1 — results from the mapping between F and A.
Use fdesign.arbmag to design a single band equiripple filter.
n = 120; f = linspace(0,1,100); % 100 frequency points. as = ones(1,100)-f*0.2; absorb = [ones(1,30),(1-0.6*bohmanwin(10))',... ones(1,5), (1-0.5*bohmanwin(8))',ones(1,47)]; a = as.*absorb; d = fdesign.arbmag('N,F,A',n,f,a); hd1 = design(d,'equiripple');
If you have the DSP System Toolbox, you can design a minimum-phase equiripple filter.
hd2 = design(d,'equiripple','MinPhase',true); hfvt = fvtool([hd1 hd2],'analysis','polezero'); legend(hfvt,'Equiripple Filter','Minimum-phase Equiripple Filter');
Use fdesign.arbmag to design a multiband minimum order filter.
This example requires the DSP System Toolbox.
Place the notches at 0.25π and 0.55π radians/sample
d = fdesign.arbmag('B,F,A,R'); d.NBands = 5; d.B1Frequencies = [0 0.2]; d.B1Amplitudes = [1 1]; d.B1Ripple = 0.25; d.B2Frequencies = 0.25; d.B2Amplitudes = 0; d.B3Frequencies = [0.3 0.5]; d.B3Amplitudes = [1 1]; d.B3Ripple = 0.25; d.B4Frequencies = 0.55; d.B4Amplitudes = 0; d.B5Frequencies = [0.6 1]; d.B5Amplitudes = [1 1]; d.B5Ripple = 0.25; Hd = design(d,'equiripple'); fvtool(Hd)
Use fdesign.arbmag to design a multiband constrained FIR filter.
This example requires the DSP System Toolbox.
Force the frequency response at 0.15π radians/sample to 0 dB.
d = fdesign.arbmag('N,B,F,A,C',82,2); d.B1Frequencies = [0 0.06 .1]; d.B1Amplitudes = [0 0 0]; d.B2Frequencies = [.15 1]; d.B2Amplitudes = [1 1]; % Design a filter with no constraints Hd1 = design(d,'equiripple','B2ForcedFrequencyPoints',0.15); % Add a constraint to the first band to increase attenuation d.B1Constrained = true; d.B1Ripple = .001; Hd2 = design(d,'equiripple','B2ForcedFrequencyPoints',0.15); hfvt = fvtool(Hd1,Hd2); legend(hfvt,'Original Design','Design with Constrained Stopband Ripple');