| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Signal Processing Toolbox |
| Contents | Index |
| Learn more about Signal Processing Toolbox |
hd = design(d,'freqsamp')
hd = design(...,'filterstructure',structure)
hd = design(...,'window',window)
hd = design(d,'freqsamp') designs a frequency-sampled filter specified by the fspecifications object h.
hd = design(...,'filterstructure',structure) returns a filter with the filter structure you specify by the structure input argument. structure is dffir by default and can be any one of the following filter structures.
Structure String | Description of Resulting Filter Structure |
|---|---|
dffir | Direct-form FIR filter |
dffirt | Transposed direct-form FIR filter |
dfsymfir | Symmetrical direct-form FIR filter |
dfasymfir | Asymmetrical direct-form FIR filter |
fftfir | Fast Fourier transform FIR filter |
hd = design(...,'window',window) designs filters using the window specified by the string in window. Provide the input argument window as
A string for the window type. For example, use bartlett or chebwin, or hamming. Click window for the full list of windows available in the Signal Processing Toolbox User's Guide.
A function handle that references the window function. When the window function requires more than one input, use a cell array to hold the required arguments. The final example shows a cell array input argument.
The window vector itself.
These examples design FIR filters that have arbitrary magnitude responses. In the first filter, the response has three distinct sections and the resulting filter is real.
The second example creates a complex filter.
b1 = 0:0.01:0.18;
b2 = [.2 .38 .4 .55 .562 .585 .6 .78];
b3 = [0.79:0.01:1];
a1 = .5+sin(2*pi*7.5*b1)/4; % Sinusoidal response section.
a2 = [.5 2.3 1 1 -.2 -.2 1 1]; % Piecewise linear response section.
a3 = .2+18*(1-b3).^2; % Quadratic response section.
f = [b1 b2 b3];
a = [a1 a2 a3];
n = 300;
d = fdesign.arbmag('n,f,a',n,f,a); % First specifications object.
hd = design(d,'freqsamp','window',{@kaiser,.5}); % Filter.
fvtool(hd)The plot from FVTool shows the response for hd.

Now design the arbitrary-magnitude complex FIR filter. Recall that vector f contains frequency locations and vector a contains the desired filter response values at the locations specified in f.
f = [-1 -.93443 -.86885 -.80328 -.7377 -.67213 -.60656 -.54098 ...
-.47541,-.40984 -.34426 -.27869 -.21311 -.14754 -.081967 ...
-.016393 .04918 .11475,.18033 .2459 .31148 .37705 .44262 ...
.5082 .57377 .63934 .70492 .77049,.83607 .90164 1];
a = [.0095848 .021972 .047249 .099869 .23119 .57569 .94032 ...
.98084 .99707,.99565 .9958 .99899 .99402 .99978 .99995 .99733 ...
.99731 .96979 .94936,.8196 .28502 .065469 .0044517 .018164 ...
.023305 .02397 .023141 .021341,.019364 .017379 .016061];
n = 48;
d = fdesign.arbmag('n,f,a',n,f,a); % Second spec. object.
hdc = design(d,'freqsamp','window','rectwin'); % Filter.
fvtool(hdc)FVTool shows you the response for hdc from -1 to 1 in normalized frequency because the filter's transfer function is not symmetric around 0. Since the Fourier transform of the filter does not exhibit conjugate symmetry, design(d,...) returns a complex—valued filter for hdc .

design, designmethods, fdesign.arbmag.
![]() | freqs | freqz | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |