When you have a plant modeled in Simulink®, you can perform frequency response estimation using Model
Linearizer or the
frestimate command without changing the
model. The Frequency Response
Estimator block is an alternative that lets you incorporate the estimation
experiment directly into your model and perform estimation while the model is running. This
approach is especially useful when you plan to deploy the block for online estimation of a
physical plant. Testing the estimation algorithm and experiment parameters against a
Simulink model of the plant before deployment can help ensure that online estimation is
safe for your plant.
The following steps provide a general overview of the workflow for online frequency response estimation of a plant modeled in Simulink.
Incorporate the Frequency Response Estimator block into your model.
Configure the start/stop signal that controls when the estimation experiment begins and ends.
Configure experiment parameters such as the frequencies at which you want to perform estimation.
Run the model. Use the start/stop signal to initiate the estimation experiment. When you start the experiment, the block injects test signals and measures the response of the plant. When you end the experiment, you can examine the estimated frequency response.
The following illustration shows one way to incorporate a Frequency Response Estimator block into a closed-loop control system. In this configuration, you insert the block between the controller and the plant.
The control signal feeds into the u port of the Frequency Response Estimator block. The u + Δu port feeds into the plant input. Before you begin the estimation process, the block feeds the control signal directly from u to u + Δu without adding any perturbation. In that state, the block has no effect on the system behavior. (You can perform frequency response estimation in an open-loop configuration by connecting u to a constant source that drives your plant to the desired operating point for estimation. However, it is a good practice to use the closed-loop configuration, particularly for real-time estimation. In a closed-loop configuration, the controller works to suppress the injected disturbance and maintain safe plant operation.)
The start/stop signal controls when the estimation process begins and ends (see Step 2. Configure Start/Stop Signal). Start the experiment when the plant is in steady state at the desired operating point. When the start/stop signal is positive, the block injects test signals at u + Δu and measures the response at y. The block calculates the estimated frequency response and returns it at the frd port.
For an example, see Online Frequency Response Estimation During Simulation.
The default configuration requires inserting the block between the controller and the plant. If you want to add the perturbation signal to the control signal yourself, in the Frequency Response Estimator block parameters, set Output Signal Configuration to perturbation only. In this configuration, the block output contains the perturbation signal only, at the port Δu. You inject this perturbation signal into the plant using, for example, a sum block, as in the following diagram.
In this configuration, because the Frequency Response Estimator is not part of the closed loop, you can optionally comment it out without disrupting the loop configuration.
To start and stop the frequency response estimation experiment, use a signal at the start/stop port. When the experiment is not running, the block generates no perturbation signal. In this state, the block has no impact on plant behavior. The frequency-response estimation experiment begins and ends when the block receives a rising or falling signal at the start/stop port, respectively. In the systems illustrated in Step 1. Incorporate Frequency Response Estimator into Model, staggered step signals start and stop the experiment. You can configure any other logic appropriate for your application to control the start and stop times of the experiment. For example, you can use a Signal Builder to configure a start/stop signal to carry out multiple experiments in a single simulation run.
The block provides a recommended experiment length in the Experiment Length section of the block parameters. Typically, you configure the start/stop signal such that there is at least that much time between the rising and falling signals. You must also make sure that the simulation does not stop before the experiment stops. For more information about how the block determines the recommended experiment length, see the Frequency Response Estimator block reference page.
The frequency-response estimation experiment injects sinusoidal signals at the frequencies you
specify with the Frequencies parameter (or at the
port) of the Frequency Response Estimation block. Specify the perturbation
amplitudes using the Amplitudes parameter (or at the
The block can apply the perturbation at each frequency separately (sinestream mode) or simultaneously (superposition mode). To specify which mode to use, set the Experiment mode parameter.
Sinestream mode — Applies the perturbation one frequency at a time. Sinestream mode can be more accurate and can accommodate a wider range of frequencies than superposition mode.
Superposition — Applies the perturbation as a superposition signal containing all frequencies at once. The estimation experiment is generally faster in superposition mode.
You can also specify parameters that tell the block how to long to let the system settle when the perturbation is applied, and how long to measure the response for the estimation. For further details about the two signal types and their relative advantages, see the Experiment mode parameter description on the Frequency Response Estimator block reference page.
After you have configured all the parameters for the estimation experiment, run the model. Allow the model to run long enough to complete the estimation experiment, based on the recommended experiment length provided by the block. If you select Display Bode plot, the block generates a Bode plot to visualize the estimated frequency response during the experiment.
During the experiment, the block updates the estimated frequency response at the
frd port. The signal at this port is a vector with one value for each
frequency specified by Frequencies. You can write this signal to the
MATLAB® workspace using a To Workspace block, or use Simulink data logging to write the data to the workspace as a
Simulink.SimulationData.Dataset object. The logged values show the convergence
of the frequency responses during the experiment. The most meaningful value is the value
when the experiment stops. For that reason, you can discard all values except the last
For an example of a model configured to perform online frequency response estimation, see Online Frequency Response Estimation During Simulation.