Signal Processing Toolbox |
Generating an M-File
You can generate an M-file that contains all the code used to create the filter you designed in FDATool. Select Generate M-file from the File menu and specify the filename in the Generate M-file dialog box.
The following is a sample generated M-file of the default FDATool filter.
function Hd = untitled
%UNTITLED Returns a discrete-time filter object
%
% M-file generated by MATLAB(R) 6.5 and the Signal Processing
% Toolbox 6.0.
%
% Generated on: 24-Oct-2002 09:46:59
%
% Remez FIR 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 = 16; % 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 |
© 1994-2005 The MathWorks, Inc.