fdesign.arbmag - Arbitrary response magnitude filter specification object

Syntax

d = fdesign.arbmag
d = fdesign.arbmag(specification)
d = fdesign.arbmag(specification,specvalue1,specvalue2,...)
d = fdesign.arbmag(specvalue1,specvalue2,specvalue3)
d = fdesign.arbmag(...,fs)

Description

d = fdesign.arbmag constructs an arbitrary magnitude filter designer d.

d = fdesign.arbmag(specification) initializes the Specification property for specifications object d to the string in specification. The input argument specification must be one of the strings shown in the following table. Specification strings are not case sensitive.

Specification String

Description of Resulting Filter

n,f,a

Single band design (default). FIR and IIR (n is the order for both numerator and denominator).

n,b,f,a

Multiband design where b defines the number of bands.

nb,na,f,a

IIR single band design.

nb,na,b,f,a

IIR multiband design where b defines the number of bands

The following table describes the arguments in the specification strings.

Argument

Description

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.

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.

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

Specifying f and a

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. A filter that used f and a might look like the one shown in the following figure.

Different specification types often have different design methods available. Use designmethods(d) to get a list of design methods available for a given specification string and specifications object.

d = fdesign.arbmag(specification,specvalue1,specvalue2,...) initializes the filter specification object specifications with specvalue1, specvalue2, and so on. Use get(d,'description') for descriptions of the various specifications specvalue1, specvalue2, ... specn.

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

These three examples introduce designing filters that have arbitrary filter response shapes. In this first example, use fdesign.arbmag to design a single-band, arbitrary-magnitude FIR filter. The design process uses the default design method for the n,f,a specification, as shown in the following code:

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; % Optical absorption of atomic Rubidium 87 vapor.
d = fdesign.arbmag(n,f,a);
hd1 = design(d,'freqsamp');

Next, design a single-band, arbitrary-magnitude IIR filter and display the magnitude response in FVTool. Use f and a from the previous example as input arguments for this case. Display the response from the previous example in FVTool as well, because the FIR and IIR filters are similar.

To demonstrate that the same specification generates both FIR and IIR filters, use the same specifications object d, but change the design method to iirlpnorm.

d.filterorder=10
 
d =
 
                Response: 'Arbitrary Magnitude' 
           Specification: 'N,F,A'          
             Description: {'Filter Order';'Frequency Vector';'
                            Amplitude Vector'}
     NormalizedFrequency: true            
             FilterOrder: 10     
             Frequencies: [1x100 double]      
              Amplitudes: [1x100 double] 
                                       
hd2=design(d,'iirlpnorm') % Design an IIR filter from the same object.
 
hd2 =
 
         FilterStructure: 'Direct-Form II, Second-Order Sections'
              Arithmetic: 'double'                               
               sosMatrix: [5x6 double]                           
             ScaleValues: [0.85714867585342;1;1;1;1;1]           
        PersistentMemory: false    

fvtool(hd1,hd2)

FVTool returns the following plot for the filters.

For the third example, design a multiband filter for noise shaping when you are simulating the Rayleigh fading phenomenon in a wireless communications channel. This example uses the default design method for fdesign.arbmag specifications objects with the nb,na,nbands specification—iirlpnorm.

nb = 4;     % Numerator order.
na = 6;     % Denominator order.
nbands = 2; % Number of filter bands.
f1 = 0:0.01:0.4; % Frequency vector values.
a1 = 1.0 ./ (1 - (f1./0.42).^2).^0.25; % Amplitude values.
f2 = [.45 1];
a2 = [0 0];
d = fdesign.arbmag('nb,na,b,f,a',nb,na,nbands,f1,a1,f2,a2);
design(d); % Starts FVTool to display the filter response.

The filter response shows the characteristic shape for noise shaping—increasing gain with increasing frequency in the passband, and a narrow transition region.

See Also

design, designopts, fdesign, setspecs

  


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