Signal Processing Toolbox |
Accessing Filter Parameters
You can access filter parameters in the following two ways.
Accessing Filter Parameters in a Saved Filter
The MATLAB structures created by SPTool have several associated fields, many of which are also MATLAB structures. See the MATLAB documentation for general information about MATLAB structures.
For example, after exporting a filter filt1 to the MATLAB workspace, type
to display the fields of the MATLAB filter structure. The tf
, Fs
, and specs
fields of the structure contain the information that describes the filter.
The tf Field: Accessing Filter Coefficients
The tf
field is a structure containing the transfer function representation of the filter. Use this field to obtain the filter coefficients;
filt1.tf.num
contains the numerator coefficients.
filt1.tf.den
contains the denominator coefficients.
The vectors contained in these structures represent polynomials in descending powers of z. The numerator and denominator polynomials are used to specify the transfer function
tf.num
field.
tf.den
field.
You can change the filter representation from the default transfer function to another form by using the tf2ss
or tf2zp
functions.
The Fs Field: Accessing Filter Sample Frequency
The Fs
field contains the sampling frequency of the filter in hertz.
The specs Field: Accessing other Filter Parameters
The specs
field is a structure containing parameters that you specified for the filter design. The first field, specs.currentModule
, contains a string representing the most recent design method selected from the Filter Designer's Algorithm list before you exported the filter. The possible contents of the currentModule
field and the corresponding design methods are shown below.
Following the specs.currentModule
field, there may be up to seven additional fields, with labels such as specs.fdremez
, specs.fdfirls
, etc. The design specifications for the most recently exported filter are contained in the field whose label matches the currentModule
string. For example, if the specs
structure is
the filter specifications are contained in the fdremez
field, which is itself a data structure.
The specifications include the parameter values from the Specifications region of the Filter Designer, such as band edges and filter order. For example, the filter above has the following specifications stored in filt1.specs.fdremez
:
filt1.specs.fdremez ans = setOrderFlag: 0 type: 3 f: [0 0.2000 0.3000 0.5000 0.6000 1] m: [6x1 double] Rp: 0.0100 Rs: 75 wt: [3.2371 1 3.2371] order: 78
Because certain filter parameters are unique to a particular design, this structure has a different set of fields for each filter design.
The table below describes the possible fields associated with the filter design specification field (the specs
field) that can appear in the exported structure.
Accessing Parameters in a Saved Spectrum
The following structure fields describe the spectra saved by SPTool.
You can access the information in these fields as you do with every MATLAB structure.
For example, if you export an SPTool PSD estimate spect1
to the workspace, type
to obtain the vector of associated power values.
Exporting Signals, Filters, and Spectra | Importing Filters and Spectra into SPTool |
© 1994-2005 The MathWorks, Inc.