| Contents | Index |
You can generate MATLAB code that constructs the filter you designed in FDATool from the command line. Select File > Generate MATLAB Code > Filter Design Function and specify the filename in the Generate MATLAB code dialog box.
Note You cannot generate MATLAB code (File > Generate MATLAB Code > Filter Design Function) if your filter was designed or edited with the Pole/Zero Editor. |
The following is generated MATLAB code for the default lowpass filter in FDATool.
function Hd = ExFilter
%EXFILTER Returns a discrete-time filter object.
%
% MATLAB Code
% Generated by MATLAB(R) 7.11 and the Signal Processing Toolbox 6.14.
%
% Generated on: 17-Feb-2010 14:15:37
%
% Equiripple Lowpass filter designed using the FIRPM function.
% All frequency values are in Hz.
Fs = 48000; % Sampling Frequency
Fpass = 9600; % Passband Frequency
Fstop = 12000; % Stopband Frequency
Dpass = 0.057501127785; % Passband Ripple
Dstop = 0.0001; % Stopband Attenuation
dens = 20; % Density Factor
% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), [1 0], [Dpass, Dstop]);
% Calculate the coefficients using the FIRPM function.
b = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);
% [EOF]
![]() | Generating a C Header File | Managing Filters in the Current Session | ![]() |

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 |