Main Content

Troubleshooting Frequency Response Estimation

R2026b

When to Troubleshoot

If, after analyzing your frequency response estimation, the frequency response plot does not match the expected behavior of your system, you can use the time response and FFT plots to help you improve the results.

If your estimation is slow or you run out of memory during estimation, see Managing Estimation Speed and Memory.

Time Response Not at Steady State

This time response has not reached steady state.

This plot shows a steady-state time response.

Because frequency response estimation requires steady-state input and output signals, transients produce inaccurate estimation results.

For sinestream input signals, transients sometimes interfere with the estimation either directly or indirectly through spectral leakage. For chirp input signals, transients interfere with estimation.

Possible CauseAction
Model cannot initialize to steady state.
(Sinestream input) Not enough periods for the output to reach steady state.
  • Increase the number of periods for frequencies that do not reach steady state by changing the NumPeriods and SettlingPeriods. See Modify Estimation Input Signals.

  • Check that filtering is enabled during estimation. You enable filtering by setting the ApplyFilteringInFRESTIMATE option to on. For information about how estimation uses filtering, see the frestimate reference page.

(Chirp input) Signal sweeps through the frequency range too quickly.Increase the simulation time by increasing NumSamples. See Modify Estimation Input Signals.

After you try the suggested actions, recompute the estimation either:

  • At all frequencies

  • In a particular frequency range (only for sinestream input signals)

To recompute the estimation in a particular frequency range:

  1. Determine the frequencies for which you want to recompute the estimation results. Then, extract a portion of the sinestream input signal at these frequencies using fselect.

    For example, these commands extract a sinestream input signal between 10 and 20 rad/s from the input signal input:

    input2 = fselect(input,10,20);

  2. Modify the properties of the extracted sinestream input signal input2, as described in Modify Estimation Input Signals.

  3. Estimate the frequency response sysest2 with the modified input signal using frestimate.

  4. Merge the original estimated frequency response sysest and the recomputed estimated frequency response sysest2:

    1. Remove data from sysest at the frequencies in sysest2 using fdel.

      sysest = fdel(sysest,input2.Frequency)

    2. Concatenate the original and recomputed responses using fcat.

      sys_combined = fcat(sysest2,sysest)

Analyze the recomputed frequency response, as described in Analyze Estimated Frequency Response.

For an example of frequency response estimation with time-varying source blocks, see Effects of Time-Varying Source Blocks on Frequency Response Estimation

FFT Contains Large Harmonics at Frequencies Other than the Input Signal Frequency

When the FFT plot shows large amplitudes at frequencies other than the input signal, your model is operating outside the linear range. This condition can cause problems when you want to analyze the response of your linear system to small perturbations.

For models operating in the linear range, the input amplitude A1 in y(t) must be larger than the amplitudes of other harmonics, A2 and A3.

u(t)=A1sin(ω1+ϕ1)y(t)=A1sin(ω1+ϕ1)+A2sin(ω2+ϕ2)+A3sin(ω3+ϕ3)+...

Adjust the amplitude of your input signal to decrease the impact of other harmonics, and repeat the estimation. Typically, you should decrease the input amplitude level to keep the model operating in the linear range.

For more information about modifying signal amplitudes, see one of the following:

Time Response Grows Without Bound

When the time response grows without bound, frequency response estimation results are inaccurate. Frequency response estimation is only accurate close to the operating point.

Try the suggested actions listed the table and repeat the estimation.

Possible CauseAction
Model is unstable.You cannot estimate the frequency response using frestimate. Instead, use exact linearization to get a linear representation of your model. See Linearize Simulink Model at Model Operating Point or the linearize reference page.
Stable model is not at steady state.Disable all source blocks in your model, and repeat the estimation using a steady-state operating point. See Compute Steady-State Operating Points.
Stable model captures a growing transient.

If the model captures a growing transient, increase the number of periods in the input signal by changing NumPeriods. Repeat the estimation using a steady-state operating point.

Time Response Is Discontinuous or Zero

Discontinuities or noise in the time response indicate that the amplitude of your input signal is too small to overcome the effects of the discontinuous blocks in your model. Examples of discontinuous blocks include Quantizer, Backlash, and Dead Zones.

If you used a sinestream input signal and estimated with filtering, turn filtering off in the Simulation Results Viewer to see the unfiltered time response.

The following model with a Quantizer block shows an example of the impact of an input signal that is too small. When you estimate this model, the unfiltered simulation output includes discontinuities.

Increase the amplitude of your input signal, and repeat the estimation.

With a larger amplitude, the unfiltered simulated output of the model with a Quantizer block is smooth.

For more information about modifying signal amplitudes, see one of the following:

Time Response Is Noisy

When the time response is noisy, frequency response estimation results may be biased.

frestimate does not support estimating frequency response estimation of Simulink® models with blocks that model noise. Locate such blocks with frest.findSources and disable them using the BlocksToHoldConstant option of frestimate.

If you need to estimate a model with noise, use frestimate to simulate an output signal from your Simulink model for estimation—without modifying your model. Then, use the Signal Processing Toolbox™ or System Identification Toolbox™ software to estimate a model.

To simulate the output of your model in response to a specified input signal:

  1. Create a random input signal. For example:

    in = frest.Random('Ts',0.001,'NumSamples',1e4);
    

    You can also specify your own custom signal as a timeseries object. For example:

    t = 0:0.001:10;
    y = sin(2*pi*t);
    in_ts = timeseries(y,t);
  2. Simulate the model to obtain the output signal. For example:

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

    The second output argument of frestimate, simout, is a Simulink.Timeseries object that stores the simulated output. in_ts is the corresponding input data.

  3. Generate timeseries objects before using with other MathWorks® products:

    input = generateTimeseries(in_ts);
    output = simout{1}.Data;

    You can use data from timeseries objects directly in Signal Processing Toolbox software, or convert these objects to System Identification Toolbox data format. For examples, see Estimate Frequency Response Models with Noise Using Signal Processing Toolbox and Estimate Frequency Response Models with Noise Using System Identification Toolbox.

For a related example, see Disable Noise Sources During Frequency Response Estimation.

Time Response Shows Harmonics That Do Not Change Smoothly

The estimated frequency response result does not match the linear system bode plot, possibly only over a certain frequency range. When the time responses show magnitudes that do not change smoothly, additional frequency components are affecting the response. These additional frequency components come from the defined input signal.

When the input signal is created using frest.Sinestream, the default value of SamplesPerPeriod is 40. This default setting produces a coarse input signal, which causes the mismatch in the bode plot.

To create a smoother input signal, increase the value of the SamplesPerPeriod setting. For more information about setting SamplesPerPeriod, see the following: