Skip to Main Content Skip to Search
Product Documentation

fdesign.arbmag - Arbitrary response magnitude filter specification object

Syntax

D= fdesign.arbmag
D= fdesign.arbmag(SPEC)
D = fdesign.arbmag(SPEC,specvalue1,specvalue2,...)
D = fdesign.arbmag(specvalue1,specvalue2,specvalue3)
D = fdesign.arbmag(...,Fs)

Description

D= fdesign.arbmag constructs an arbitrary magnitude filter specification object D.

D= fdesign.arbmag(SPEC) initializes the Specification property to SPEC. The input argument SPEC must be one of the strings shown in the following table. Specification strings are not case sensitive.

The string entries are defined as follows:

By default, this method assumes that all frequency specifications are supplied in normalized frequency.

Specifying Frequency and Amplitude Vectors

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 example creates a filter with two passbands (B = 4) and shows how F and A are related. This example is for illustration only. It is not an actual filter.

Define the frequency vector F as [0 0.1 0.2 0.4 0.5 0.6 0.9 1.0]

Define the response vector A as [0 0.5 0.5 0.1 0.1 0.8 0.8 0]

These specifications connect F and A as shown in the following table.

F (Normalized Frequency)

A (Response Desired at F)

0

0

0.1

0.5

0.2

0.5

0.4

0.1

0.5

0.1

0.6

0.8

0.9

0.8

1.0

0.0

A response with two passband—one roughly between 0.1 and 0.2 and the second between 0.6 and 0.9—results from the mapping between F and A.

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.

D = fdesign.arbmag(...,Fs) specifies the sampling frequency in Hz. All other frequency specifications are also assumed to be in Hz when you specify Fs.

Examples

Design a single band arbitrary-magnitude equiripple FIR 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');
 

The following example requires the DSP System Toolbox. Design a multiband minimum order filter with 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)

 

The following example requires the DSP System Toolbox. Design a multiband constrained arbitrary magnitude FIR filter. 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');

See Also

design | designmethods | fdesign

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS