To plot the disturbance spectrum of an input-output model or
the output spectrum of a time series model, use `spectrum`

. To customize such plots, or
to turn on the confidence region view programmatically for such plots,
use `spectrumplot`

instead.

To determine if your estimated noise model is good enough, you
can compare the output spectrum of the estimated noise-model *H* to
the estimated output spectrum of *v(t)*. To compute *v(t)*,
which represents the actual noise term in the system, use the following
commands:

ysimulated = sim(m,data); v = ymeasured-ysimulated;

`ymeasured`

is `data.y`

. `v`

is
the noise term *v(t)*, as described in What Does a Noise Spectrum Plot Show? and
corresponds to the difference between the simulated response `ysimulated`

and
the actual response `ymeasured`

.

To compute the frequency-response model of the actual noise,
use `spa`

:

V = spa(v);

The toolbox uses the following equation to compute the noise spectrum of the actual noise:

$${\Phi}_{v}(\omega )={\displaystyle \sum _{\tau =-\infty}^{\infty}{R}_{v}}\left(\tau \right){e}^{-i\omega \tau}$$

The covariance function $${R}_{v}$$ is
given in terms of *E*, which denotes the mathematical
expectation, as follows:

$${R}_{v}\left(\tau \right)=Ev\left(t\right)v\left(t-\tau \right)$$

To compare the parametric noise-model *H* to
the (nonparametric) frequency-response estimate of the actual noise *v(t)*,
use `spectrum`

:

spectrum(V,m)

If the parametric and the nonparametric estimates of the noise spectra are different, then you might need a higher-order noise model.