Accelerating the pace of engineering and science

• Trials

# spectrum

Output power spectrum of time series models

## Syntax

spectrum(sys)
spectrum(sys,{wmin, wmax})
spectrum(sys,w)
spectrum(sys1,...,sysN,w)
ps = spectrum(sys,w)
[ps,w] = spectrum(sys)
[ps,w,sdps] = spectrum(sys)

## Description

spectrum(sys) creates an output power spectrum plot of the identified time series model sys. The frequency range and number of points are chosen automatically.

sys is a time series model, which represents the system:

Where, e(t) is a Gaussian white noise and y(t) is the observed output.

spectrum plots abs(H'H), scaled by the variance of e(t) and the sample time.

If sys is an input-output model, it represents the system:

Where, u(t) is the measured input, e(t) is a Gaussian white noise and y(t) is the observed output.

In this case, spectrum plots the spectrum of the disturbance component He(t).

spectrum(sys,{wmin, wmax}) creates a spectrum plot for frequencies ranging from wmin to wmax.

spectrum(sys,w) creates a spectrum plot using the frequencies specified in the vector w.

spectrum(sys1,...,sysN,w) creates a spectrum plot of several identified models on a single plot. The w argument is optional.

You can specify a color, line style and marker for each model. For example:

spectrum(sys1,'r',sys2,'y--',sys3,'gx');

ps = spectrum(sys,w) returns the power spectrum amplitude of sys for the specified frequencies, w. No plot is drawn on the screen.

[ps,w] = spectrum(sys) returns the frequency vector, w, for which the output power spectrum is plotted.

[ps,w,sdps] = spectrum(sys) returns the estimated standard deviations of the power spectrum.

For discrete-time models with sampling time Ts, spectrum uses the transformation z = exp(j*w*Ts) to map the unit circle to the real frequency axis. The spectrum is only plotted for frequencies smaller than the Nyquist frequency pi/Ts, and the default value 1 (time unit) is assumed when Ts is unspecified.

## Input Arguments

 sys Identified model. If sys is a time series model, it represents the system: Where, e(t) is a Gaussian white noise and y(t) is the observed output. If sys is an input-output model, it represents the system: Where, u(t) is the measured input, e(t) is a Gaussian white noise and y(t) is the observed output. wmin Minimum frequency of the frequency range for which the output power spectrum is plotted. Specify wmin in rad/TimeUnit, where TimeUnit is sys.TimeUnit. wmax Maximum frequency of the frequency range for which the output power spectrum is plotted. Specify wmax in rad/TimeUnit, where TimeUnit is sys.TimeUnit. w Frequencies for which the output power spectrum is plotted. Specify w in rad/TimeUnit, where TimeUnit is sys.TimeUnit. sys1,...,sysN Identified systems for which the output power spectrum is plotted.

## Output Arguments

 ps Power spectrum amplitude. If sys has Ny outputs, then ps is an array of size [Ny Ny length(w)]. Where ps(:,:,k) corresponds to the power spectrum for the frequency at w(k). For amplitude values in dB, type psdb = 10*log10(ps). w Frequency vector for which the output power spectrum is plotted. sdps Estimated standard deviation of the power spectrum.

## Examples

expand all

### Noise Spectrum of SISO Linear Identified Model

Plot the noise spectrum of a single-input, single-output linear identified model.

Obtain the identified model.

sys = n4sid(z1,2);

Plot the noise spectrum for the identified model.

spectrum(sys);

### Output Spectrum of AR Model for 2-Mode Impulse Response

Plot the output spectrum of an AR model, computed for a 2-mode impulse response of a dynamic system.

Obtain the identified model.