| System Identification Toolbox™ | ![]() |
Estimate frequency response and spectrum using spectral analysis returning idfrd object
g = spa(data) g = spa(data,M,w,maxsize) [g,phi,spe] = spa(data)
spa estimates the transfer function g and the noise spectrum
of the general linear
model
![]()
where
is the spectrum of
.
data contains the output-input data as an iddata object. The data can be complex valued. data can be both time domain and frequency domain. data can also be an idfrd object.
g is returned as an idfrd object (see idfrd) with the estimate of
at the frequencies
specified by row
vector w. The default value of w is
w = [1:128]/128*pi/Ts
Here Ts is the sampling interval of data.
g also includes information about the spectrum
estimate of
at the same frequencies. Both outputs
are returned with estimated covariances, included in g. See idfrd.
M is the length of the lag window used in the calculations. The default value is
M = min(30,length(data)/10)
Changing the value of M controls the frequency
resolution of the estimate. The resolution corresponding to M is approximately
/M rad/sampling interval. The value of M exchanges
bias for variance in the spectral estimate. As M is increased, the estimated functions show more detail, but are
more corrupted by noise. The sharper peaks a true frequency function
has, the higher M it needs. See etfe as an alternative for narrowband
signals and systems. The function spafdr allows the frequency resolution
to depend on the frequency. See also Identifying Frequency-Response Models.
maxsize controls the memory-speed tradeoff (see Algorithm Properties).
For time series, where data contains no input channels, g is returned with the estimated output spectrum and its estimated standard deviation.
When spa is called with two or three output arguments,
g is returned as an idfrd model with just the estimated frequency response from input to output and its uncertainty.
phi is returned as an idfrd model, containing just the spectrum data for the
output spectrum
and its uncertainty.
spe is returned as an idfrd model containing spectrum data for all output-input channels in data. That is, if z = [data.OutputData, data.InputData], spe contains as spectrum data the matrix-valued power spectrum of z.
![]()
Here win(m) is weight at lag m of an M-size Hamming window and W is the frequency value i rad/s. Note that ' denotes complex-conjugate transpose.
The normalization of the spectrum differs from the normalization used by the Signal Processing Toolbox spectrum function. SeeUnderstanding Spectrum Normalization for a more precise definition.
The covariance function estimates are computed using covf. These are multiplied by a Hamming window of lag size M and then transformed using a Fourier transform. The relevant ratios and differences are then formed. For the default frequencies, this is done using a fast Fourier transform, which is more efficient than for user-defined frequencies. For multivariable systems, a straightforward for loop is used.
Note that M =
is in Table 6.1 of Ljung (1999).
The standard deviations are computed as on pages 184 and 188 in Ljung
(1999).
With default frequencies,
g = spa(z); bode(g)
With logarithmically spaced frequencies,
w = logspace(-2,pi,128);
g= spa(z,[],w); % (empty matrix gives default)
bode(g,'sd',3)
bode(g('noise'),'sd',3) % noise spectrum with confidence
interval of 3 standard deviations.
| bode | |
| etfe | |
| ffplot | |
| freqresp | |
| idfrd | |
| nyquist | |
| spafdr |
![]() | size | spafdr | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |