Identifying Frequency-Response Models

What Is a Frequency-Response Model?

You can estimate frequency-response models and visualize the responses on a Bode plot, which shows the amplitude change and the phase shift as a function of the sinusoid frequency.

The frequency-response function describes the steady-state response of a system to sinusoidal inputs. For a linear system, a sinusoidal input of a specific frequency results in an output that is also a sinusoid with the same frequency, but with a different amplitude and phase. The frequency-response function describes the amplitude change and phase shift as a function of frequency.

For a discrete-time system sampled with a time interval T, the frequency-response model G(z) relates the Z-transforms of the input U(z) and output Y(z):

Y(z)=G(z)U(z)

In other words, the frequency-response function, G(eiwT), is the Laplace transform of the impulse response that is evaluated on the imaginary axis. The frequency-response function is the transfer function G(z) evaluated on the unit circle.

The estimation result is an idfrd model, which stores the estimated frequency response and its covariance.

Data Supported by Frequency-Response Models

You can estimate spectral analysis models from data with the following characteristics:

Estimate Frequency-Response Models in the App

You must have already imported your data into the app and performed any necessary preprocessing operations. For more information, see Data Preparation.

To estimate frequency-response 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 one 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, equivalently, the empty matrix [].

  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 Estimate to add this model to the Model Board in the System Identification app.

  7. In the Spectral Model dialog box, click Close.

  8. To view the frequency-response plot, select the Frequency resp check box in the System Identification app. For more information about working with this plot, see Frequency Response Plots.

  9. 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.

  10. Validate the model after estimating it. For more information, see Model Validation.

To export the model to the MATLAB workspace, drag it to the To Workspace rectangle in the System Identification app. You can retrieve the responses from the resulting idfrd model object using the bode or nyquist command.

Estimate Frequency-Response Models at the Command Line

You can use the etfe, spa, and spafdr commands to estimate spectral models. The following table provides a brief description of each command and usage examples.

The resulting models are stored as idfrd model objects. For detailed information about the commands and their arguments, see the corresponding reference page.

Commands for Frequency Response

CommandDescriptionUsage
etfe

Estimates an empirical transfer function using Fourier analysis.

To estimate a model m, use the following syntax:

m=etfe(data)
spa

Estimates a frequency response with a fixed frequency resolution using spectral analysis.

To estimate a model m, use the following syntax:

m=spa(data)
spafdr

Estimates a frequency response with a variable frequency resolution using spectral analysis.

To estimate a model m, use the following syntax:

m=spafdr(data,R,w)

where R is the resolution vector and w is the frequency vector.

Validate the model after estimating it. For more information, see Model Validation.

Selecting the Method for Computing Spectral Models

This section describes how to select the method for computing spectral models in the estimation procedures Estimate Frequency-Response Models in the App and Estimate Frequency-Response Models at the Command Line.

You can choose from the following three spectral-analysis methods:

  • etfe (Empirical Transfer Function Estimate)

    For input-output data. This method computes the ratio of the Fourier transform of the output to the Fourier transform of the input.

    For time-series data. This method computes a periodogram as the normalized absolute squares of the Fourier transform of the time series.

    ETFE works well for highly resonant systems or narrowband systems. The drawback of this method is that it requires linearly spaced frequency values, does not estimate the disturbance spectrum, and does not provide confidence intervals. ETFE also works well for periodic inputs and computes exact estimates at multiples of the fundamental frequency of the input and their ratio.

  • spa (SPectral Analysis)

    This method is the Blackman-Tukey spectral analysis method, where windowed versions of the covariance functions are Fourier transformed.

  • spafdr (SPectral Analysis with Frequency Dependent Resolution)

    This method is a variant of the Blackman-Tukey spectral analysis method with frequency-dependent resolution. First, the algorithm computes Fourier transforms of the inputs and outputs. Next, the products of the transformed inputs and outputs with the conjugate input transform are smoothed over local frequency regions. The widths of the local frequency regions can vary as a function of frequency. The ratio of these averages computes the frequency-response estimate.

Controlling Frequency Resolution of Spectral Models

This section supports the estimation procedures Estimate Frequency-Response Models in the App and Estimate Frequency-Response Models at the Command Line.

What Is Frequency Resolution?

Frequency resolution is the size of the smallest frequency for which details in the frequency response and the spectrum can be resolved by the estimate. A resolution of 0.1 rad/s means that the frequency response variations at frequency intervals at or below 0.1 rad/s are not resolved.

    Note:   Finer resolution results in greater uncertainty in the model estimate.

Specifying the frequency resolution for etfe and spa is different than for spafdr.

Frequency Resolution for etfe and spa

For etfe and spa, the frequency resolution is approximately equal to the following value:

2πM(radianssampling interval)

M is a scalar integer that sets the size of the lag window. The value of M controls the trade-off between bias and variance in the spectral estimate.

The default value of M for spa is good for systems without sharp resonances. For etfe, the default value of M gives the maximum resolution.

A large value of M gives good resolution, but results in more uncertain estimates. If a true frequency function has sharp peak, you should specify higher M values.

Frequency Resolution for spafdr

In case of etfe and spa, the frequency response is defined over a uniform frequency range, 0-Fs/2 radians per second, where Fs is the sampling frequency—equal to twice the Nyquist frequency. In contrast, spafdr lets you increase the resolution in a specific frequency range, such as near a resonance frequency. Conversely, you can make the frequency grid coarser in the region where the noise dominates—at higher frequencies, for example. Such customizing of the frequency grid assists in the estimation process by achieving high fidelity in the frequency range of interest.

For spafdr, the frequency resolution around the frequency k is the value R(k). You can enter R(k) in any one of the following ways:

  • Scalar value of the constant frequency resolution value in radians per second.

      Note:   The scalar R is inversely related to the M value used for etfe and spa.

  • Vector of frequency values the same size as the frequency vector.

  • Expression using MATLAB workspace variables and evaluates to a resolution vector that is the same size as the frequency vector.

The default value of the resolution for spafdr is twice the difference between neighboring frequencies in the frequency vector.

etfe Frequency Resolution for Periodic Input

If the input data is marked as periodic and contains an integer number of periods (data.Period is an integer), etfe computes the frequency response at frequencies 2πkT(kPeriod)   where k=1,2,...,Period.

For periodic data, the frequency resolution is ignored.

Spectrum Normalization

The spectrum of a signal is the square of the Fourier transform of the signal. The spectral estimate using the commands spa, spafdr, and etfe is normalized by the sampling interval T:

Φy(ω)=Tk=MMRy(kT)eiwTWM(k)

where WM(k) is the lag window, and M is the width of the lag window. The output covariance Ry(kT) is given by the following discrete representation:

R^y(kT)=1Nl=1Ny(lTkT)y(lT)

Because there is no scaling in a discrete Fourier transform of a vector, the purpose of T is to relate the discrete transform of a vector to the physically meaningful transform of the measured signal. This normalization sets the units of Φy(ω) as power per radians per unit time, and makes the frequency units radians per unit time.

The scaling factor of T is necessary to preserve the energy density of the spectrum after interpolation or decimation.

By Parseval's theorem, the average energy of the signal must equal the average energy in the estimated spectrum, as follows:

Ey2(t)=12ππ/Tπ/TΦy(ω)dωS1Ey2(t)S212ππ/Tπ/TΦy(ω)dω

To compare the left side of the equation (S1) to the right side (S2), enter the following commands. In this code, phiy contains Φy(ω) between ω=0 and ω=πT with the frequency step given as follows:

(πTlength(phiy))

load iddata1
% Create a time-series iddata object.
y = z1(:,1,[]);
% Define sample interval from the data.
T = y.Ts;
% Estimate the frequency response.
sp = spa(y);
% Remove spurious dimensions
phiy = squeeze(sp.spec);
% Compute average energy from the estimated energy spectrum, where S1 is
% scaled by T.
S1 = sum(phiy)/length(phiy)/T
% Compute average energy of the signal.
S2 = sum(y.y.^2)/size(y,1)
S1 =

   19.2076


S2 =

   19.4646

Thus, the average energy of the signal approximately equals the average energy in the estimated spectrum.

Was this topic helpful?