Frequency response estimation of Simulink models


sysest = frestimate(model,io,input)
sysest = frestimate(model,op,io,input)
[sysest,simout] = frestimate(model,op,io,input)
[sysest,simout] = frestimate(model,op,io,input,options)


sysest = frestimate(model,io,input) estimates frequency response model sysest. model is a character vector or string that specifies the name of your Simulink® model. input can be a sinestream, chirp, or random signal, or a MATLAB® timeseries object. io specifies the linearization I/O object, which you either obtain using getlinio or create using linio. I/O points cannot be on bus signals. The estimation occurs at the operating point specified in the Simulink model.

sysest = frestimate(model,op,io,input) initializes the model at the operating point op before estimating the frequency response model. Create op using either operpoint or findop.

[sysest,simout] = frestimate(model,op,io,input) estimates frequency response model and returns the simulated output simout. This output is a cell array of Simulink.Timeseries objects with dimensions m-by-n. m is the number of linearization output points, and n is the number of input channels.

[sysest,simout] = frestimate(model,op,io,input,options) uses the frequency response options (options) to estimate the frequency response. Specify these options using frestimateOptions.


Estimating frequency response for a Simulink model:

% Create input signal for simulation:
input = frest.Sinestream('Frequency',logspace(-3,2,30));

% Open the Simulink model:

% Specify portion of model to estimate:
io(1)=linio('watertank/PID Controller',1,'input');
io(2)=linio('watertank/Water-Tank System',1,'openoutput');

% Specify the steady state operating point for the estimation.
watertank_spec = operspec('watertank');
op = findop('watertank',watertank_spec);

% Estimate frequency response of specified blocks:
sysest = frestimate('watertank',op,io,input);

Validate exact linearization results using estimated frequency response of a Simulink model:

% Open the Simulink model:

% Specify portion of model to estimate:
io(1)=linio('watertank/PID Controller',1,'input');
io(2)=linio('watertank/Water-Tank System',1,'output');

% Specify operating point for linearization and estimation:
watertank_spec = operspec('watertank');
op = findop('watertank',watertank_spec);

% Linearize the model:
sys = linearize('watertank',op,io);

% Estimate the frequency response of the watertank model
input = frest.Sinestream('Frequency',logspace(-1,2,10));
[sysest,simout] = frestimate('watertank',op,io,input);

% Compare linearization and estimation results in frequency domain:


frestimate performs the following operations when you use the sinestream signal:

  1. Injects the sinestream input signal you design, uest(t), at the linearization input point.

  2. Simulates the output at the linearization output point.

    frestimate adds the signal you design to existing Simulink signals at the linearization input point.

  3. Discards the SettlingPeriods portion of the output (and the corresponding input) at each frequency.

    The simulated output at each frequency has a transient portion and steady state portion. SettlingPeriods corresponds to the transient components of the output and input signals. The periods following SettlingPeriods are considered to be at steady state.

  4. Filters the remaining portion of the output and the corresponding input signals at each input frequency using a bandpass filter. Because most models are not at steady state, the response might contain low-frequency transient behavior. Filtering typically improves the accuracy of your model by removing the effects of frequencies other than the input frequencies, which are problematic when sampling and analyzing data of finite length. These effects are called spectral leakage.

    Any transients associated with filtering are only in the first period of the filtered steady-state output. After filtering, frestimate discards the first period of the input and output signals. frestimate uses a finite impulse response (FIR) filter, whose order matches the number of samples in a period.

  5. Estimates the frequency response of the processed signal by computing the ratio of the fast Fourier transform of the filtered steady-state portion of the output signal yest(t) and the fast Fourier transform of the filtered input signal uest(t):


    To compute the response at each frequency, frestimate uses only the simulation output at that frequency.

Introduced in R2009b

Was this topic helpful?