Signal Processing Toolbox Previous page   Next Page

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;

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

where:

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.

Contents of the currentModule field
Design Method
fdbutter
Butterworth IIR
fdcheby1
Chebyshev Type I IIR
fdcheby2
Chebyshev Type II IIR
fdellip
Elliptic IIR
fdfirls
Least Squares FIR
fdkaiser
Kaiser Window FIR
fdremez
Equiripple FIR

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:

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.

Parameter
Description
Beta
Kaiser window beta parameter.
f
Contains a vector of band-edge frequencies, normalized so that 1 Hz corresponds to half the sample frequency.
Fpass
Passband cutoff frequencies. Scalar for lowpass and highpass designs, two-element vector for bandpass and bandstop designs.
Fstop
Stopband cutoff frequencies. Scalar for lowpass and highpass designs, two-element vector for bandpass and bandstop designs.
m
The response magnitudes corresponding to the band-edge frequencies in f.
order
Filter order.
Rp
Passband ripple (dB)
Rs
Stopband attenuation (dB)
setOrderFlag
Contains 1 if the filter order was specified manually (i.e., the Minimum Order box in the Specifications region was not selected). Contains 0 if the filter order was computed automatically.
type
Contains 1 for lowpass, 2 for highpass, 3 for bandpass, or 4 for bandstop.
w3db
-3 dB frequency for Butterworth IIR designs.
wind
Vector of Kaiser window coefficients.
Wn
Cutoff frequency for the Kaiser window FIR filter when setOrderFlag = 1.
wt
Vector of weights, one weight per frequency band.

Accessing Parameters in a Saved Spectrum

The following structure fields describe the spectra saved by SPTool.

Field
Description
P
The spectral power vector.
f
The spectral frequency vector.
confid
A structure containing the confidence intervals data
  • The confid.level field contains the chosen confidence level.
  • The confid.Pc field contains the spectral power data for the confidence intervals.
  • The confid.enable field contains a 1 if confidence levels are enabled for the power spectral density.
signalLabel
The name of the signal from which the power spectral density was generated.
Fs
The associated signal's sample rate.

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.


Previous page  Exporting Signals, Filters, and Spectra Importing Filters and Spectra into SPTool Next page

© 1994-2005 The MathWorks, Inc.