Signal Processing Toolbox Previous page   Next Page
dspdata

DSP data parameter information

Syntax

Description

Hs = dspdata.dataobj(input1,...) returns a dspdata object Hs of type dataobj. This object contains all the parameter information needed for the specified type of dataobj. Each dataobj takes one or more inputs, which are described on the individual reference pages. If you do not specify any input values, the returned object has default property values appropriate for the particular dataobj type.

Data Objects

A data object (dataobj) for dspdata specifies the type of data stored in the object. Available dataobj types for dspdata are shown below.

dspdata.dataobj
Description
dspdata.msspectrum
Mean-square spectrum data (power)
dspdata.psd
Power spectral density data (power/frequency)
dspdata.pseudospectrum
Pseudospectrum data (power)

For more information on each dataobj type, refer to its reference page.

Methods

Methods provide ways of performing functions directly on your dspdata object. You can apply these methods directly on the variable you assigned to your dspdata object.

.

Method
Description
avgpower

Note that this method applies only to dspdata.psd objects.

avgpower(Hs) computes the average power in a given frequency band. The technique uses a rectangle approximation of the integral of the Hs signal's power spectral density (PSD). If the signal is a matrix, the computation is done on each column. The average power is the total signal power and the SpectrumType property determines whether the total average power is contained in the one-sided or two-sided spectrum. For aa one-sided spectrum, the range is [0,pi] for even number of frequency points and [0,pi) for odd. For a two-sided spectrum the range is [0,2pi).

avgpower(Hs,freqrange) specifies the frequency range over which to calculate the average power. freqrange is a two-element vector of the frequencies between which to calculate. If a frequency value does not match exactly the frequency in Hs, the next closest value is used. Note that the first frequency value in freqrange is included in the calculation and the second value is excluded.

centerdc

centerdc(Hs) or centerdc(Hs,true) shifts the data and frequency values so that the DC component is at the center of the spectrum. If the SpectrumType property is 'onesided', it is changed to 'twosided' and then the DC component is centered.

centerdc(Hs,'false') shifts the data and frequency values so that the DC component is at the left edge of the spectrum.

halfrange

halfrange(Hs) converts the Hs spectrum to a spectrum calculated over half the Nyquist interval. All associated properties affected by the new frequency range are adjusted automatically. This method is used for dspdata.pseudospectrum objects.

Note that the spectrum is assumed to be from a real signal (that is, halfrange uses half the data points regardless of whether the data is symmetric).

normalizefreq

normalizefreq(Hs) or normalizefreq(Hs,true) normalizes the frequency specifications in the Hs object to Fs so the frequencies are between 0 and 1. It also sets the NormalizedFrequency property to true.

normalizefreq(Hs,false) converts the frequencies to linear frequencies.

normalizefreq(Hs,false,Fs) sets a new sampling frequency Fs. This can be used only with false.

onesided

onesided(Hs) converts the Hs spectrum to a spectrum calculated over half the Nyquist interval and containing the total signal power. All associated properties affected by the new frequency range are adjusted automatically. This method is used for dspdata.psd and dspdata.msspectrum objects.

Note that the spectrum is assumed to be from a real signal (that is, onesided uses half the data points regardless of whether the data is symmetric).

plot

Displays the data graphically in a plot window.

twosided

twosided(Hs) converts the Hs spectrum to a spectrum calculated over the whole Nyquist interval. All associated properties affected by the new frequency range are adjusted automatically. This method is used for dspdata.psd and dspdata.msspectrum objects.

Note that if your data is nonuniformly sampled, converting from onesided to twosided may produce incorrect results.

wholerange

wholerange(Hs) converts the Hs spectrum to a spectrum calculated over the whole Nyquist interval. All associated properties affected by the new frequency range are adjusted automatically. This method is used for dspdata.pseudospectrum objects.

Note that if your data is nonuniformly sampled, converting from half to wholerange may produce incorrect results.

Plotting a DSPDATA Object

The plot method displays the dspdata object spectrum in a separate figure window.

Modifying a DSPDATA Object

After you create a dspdata object, you can use any of the methods in the table above to modify the object properties.

For example, to change the object from two-sided to one-sided, use

The Hs object is modifed.

Examples

(See the msspectrum, psd, or pseudospectrum reference pages for specific examples.)

See Also

dspdata.msspectrum, dspdata.psd, dspdata.pseudospectrum


Previous page  dpsssave dspdata.msspectrum Next page

© 1994-2005 The MathWorks, Inc.