## Estimate Time-Series Power Spectra

A frequency-response model encapsulates the frequency response of a linear system evaluated over a range of frequency values. When the data contains both input and output channels, the frequency-response model describes the steady-state response of the system to sinusoidal inputs. Time-series data contains no input channel. The frequency response of a time series model reduces to a spectral representation of the output data. This output data implicitly includes the effects of the unmeasured input noise.

For a discrete-time system sampled for both inputs and outputs with a time interval T, the transfer function G(z) relates the Z-transforms of the input U(z) and output Y(z):

Y(z) = G(z)U(z) + H(z)E(z)

H(z) represents the noise transfer functions for each output and E(z) is the Z-transform of the additive disturbance e(t) with variance Λ.

For a time-series model, this equation reduces to:

Y(z) = H(z)E(z)

In this case, E(z) represents the assumed, but unmeasured, white-noise input disturbance. The single-output noise spectrum Φ in the presence of disturbance noise with scalar variance λ is defined as:

${\Phi }_{v}\left(\omega \right)=\lambda T{|H\left(e{}^{i\omega T}\right)|}^{2}$

The equivalent multi-output noise power spectrum can be given as:

${\Phi }_{v}\left(\omega \right)=TH\left({e}^{i\omega T}\right)\Lambda {H}^{\prime }\left({e}^{-i\omega T}\right)$

Here, Λ is the variance vector with a length equal to the number of outputs.

### Estimate Time-Series Power Spectra at the Command Line

You can use the etfe, spa, and spafdr commands to estimate power spectra of time series for both time-domain and frequency-domain data. These functions return estimated models that are represented by idfrd model objects, which contain the spectral data in the property SpectrumData and the spectral variance in the property NoiseCovariance. For multiple-output data, SpectrumData contains power spectra of each output and the cross-spectra between each output pair.

Commands for Estimating and Comparing Frequency Response of Time Series

CommandDescription
etfe

Estimates a periodogram using Fourier analysis.

spa

Estimates the power spectrum with its standard deviation using spectral analysis.

spafdr

Estimates the power spectrum with its standard deviation using a variable frequency resolution.

spectrumEstimates and plots the output power spectrum of time series models.

For example, suppose y is time series data. Estimate the power spectrum g and the periodogram p using spa and etfe. Plot the models together with three standard deviation confidence intervals by using spectrum.

g = spa(y);
p = etfe(y);
spectrum(g,p);

For a more detailed example of spectral estimation, see Identify Time Series Models at the Command Line. For more information about the individual commands, see the corresponding reference pages.

### Estimate Time-Series Power Spectra Using the App

To estimate time series spectral models in the System Identification app:

1. In the System Identification app, select Estimate > Spectral Models to open the Spectral Model dialog box.

2. In the Method list, select the spectral analysis method you want to use. For information about each method, see Selecting the Method for Computing Spectral Models.

3. Specify the frequencies at which to compute the spectral model in either of the following ways:

• In the Frequencies field, enter either a vector of values, a MATLAB® expression that evaluates to a vector, or a variable name of a vector in the MATLAB workspace. For example, logspace(-1,2,500).

• Use the combination of Frequency Spacing and Frequencies to construct the frequency vector of values:

• In the Frequency Spacing list, select Linear or Logarithmic frequency spacing.

Note

For etfe, only the Linear option is available.

• In the Frequencies field, enter the number of frequency points.

For time-domain data, the frequency ranges from 0 to the Nyquist frequency. For frequency-domain data, the frequency ranges from the smallest to the largest frequency in the data set.

4. In the Frequency Resolution field, enter the frequency resolution, as described in Controlling Frequency Resolution of Spectral Models. To use the default value, enter default or leave the field empty.

5. In the Model Name field, enter the name of the correlation analysis model. The model name should be unique in the Model Board.

6. Click to add this model to the Model Board in the System Identification app.

7. In the Spectral Model dialog box, click .

8. To view the estimated disturbance spectrum, select the Noise spectrum check box in the System Identification app. For more information about working with this plot, see Noise Spectrum Plots.

To export the model to the MATLAB workspace, drag it to the To Workspace rectangle in the System Identification app. You can view the power spectrum and the confidence intervals of the resulting idfrd model object using the spectrum command.

Get trial now