Estimate Frequency Response (MATLAB Code)

  1. Open Simulink® model.

    mdl = 'scdplane';

    To learn more about general model requirements, see Model Requirements.

  2. Specify input and output points for frequency response estimation, using linearization I/O points.

    io(1) = linio('scdplane/Sum1',1)
    io(2) = linio('scdplane/Gain5',1,'output')

      Caution   Avoid placing I/O points on bus signals.

    For more information about linearization I/O points, see Specifying Portion of Model to Linearize and the linio reference page.

  3. Create an input signal for estimation.

    sys = linearize('scdplane',io);
    input = frest.Sinestream(sys)

    See Estimation Input Signals.

  4. (Optional) If your model has not reached steady state, initialize the model at a steady state operating point.

    You can check whether your model is at steady state by simulating the model. See operspec and findop reference pages.

  5. Disable all source blocks that generate time-varying signals in the signal path of the linearization outputs. Such time-varying signals can interfere with the signal at the linearization output points and produce inaccurate estimation results.

    1. Identify the time-varying source blocks.

      srcblks = frest.findSources('scdplane',io); 
    2. Disable these source blocks.

      opts = frestimateOptions;
      opts.BlocksToHoldConstant = srcblks;

    For more information, see the frest.findSources and frestimateOptions reference pages.

  6. Estimate the frequency response.

    [sysest,simout] = frestimate('scdplane',io,input,opts);

    sysest is the estimated frequency response. simout is the simulated output that is a Simulink.Timeseries object.

    For more information about syntax and argument descriptions, see the frestimate reference page.

  7. Open the Simulation Results Viewer to analyze the estimated frequency response. For example:


    You can compare the estimated frequency response (sysest) to a system you linearized using exact linearization (sys):


See Also

| | | | |

More About

Was this topic helpful?