Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Toolbox   

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 FIR design (default).

n,b,f,a

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.

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.

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 passbands (one 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 .

Different specification types often have different design methods available. Use designmethods 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

Design an arbitrary magnitude FIR filter:

n = 120; % Filter order
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',n,f,a);
hd = design(d,'freqsamp');
H=freqz(hd,100); % Filter frequency response
plot(f,20*log10(a),'r');
hold on;
plot(f,20*log10(abs(H)),'k');
xlabel('Normalized Frequency (x \pi radians/sample)');
ylabel('Magnitude (dB)');
legend('Desired Frequency Response','Filter Frequency Response');

Compare single-band and multiband designs with staircase stopband attenuation:

% Single-band design
N = 150;
% Frequency and amplitude vectors for single-band design
F = [0 .25 .3 .4 .401 .5 .501 .6 .601 .7 .701 .8 .801 .9 .901 1];
A = [1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
% Weights for stopband attenuation 5-dB per frequency element
W = 10.^([0 0 5 5 10 10 15 15 20 20 25 25 30 30 35 35]/20);
d = fdesign.arbmag('N,F,A',N,F,A);
Hd = design(d,'equiripple','weights',W);
% Multiband design (2 bands)
B=2;
F1=F(1:2); % Passband
F2=F(3:end); % Stopband
A1 = A(1:2);
A2 = A(3:end);
W1 = W(1:2);
W2 = W(3:end);
d = fdesign.arbmag('N,B,F,A',N,B,F1,A1,F2,A2);
Hd(2) = design(d,'equiripple','B1Weights',W1,'B2Weights',W2);
hfvt=fvtool(Hd);
legend(hfvt,'Single-band Design','Multiband Design');

See Also

design, designmethods, fdesign

  


Recommended Products

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

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