| Contents | Index |
| On this page… |
|---|
This example shows how to validate linearization results by comparing the Bode response plots of the estimated nonlinear model of the plant and its linearization.
Linearize Simulink model.
Open Simulink model
sys = 'scdspeedctrl'; open_system(sys)
In the Simulink model window, select Tools > Control Design > Linear Analysis.
This action opens the Linear Analysis Tool for the model.
In the Operating Point drop-down list, select Trim model. This action opens the Trim Model tab.
Click
to trim the model. The trimmed operating operating
point op_trim1 appears in the Linear
Analysis Workspace.
In the Exact Linearization tab, choose op_trim1 in the Operating Point list.
In the Plot Result list, choose New Bode.
Click
to linearize the model using op_trim1 as
the operating point.
A new linearized model, linsys1, appears in the Linear Analysis Workspace.
In the Frequency Response Estimation tab, select Sinestream from the Input Signal list.

This action opens the Create sinestream input dialog which may be used to create an input signal to validate the linearized model.
Click Initialize frequencies and parameters to initialize the input signal frequencies and parameters based on linsys1.

This action populates the Frequency content viewer with frequency points. The frequency points and their parameters have been chosen based on the dynamics of linsys1.

Click OK. This action creates the input signal in_sine1 in the Linear Analysis Workspace.
In the Frequency Response Estimation tab, select op_trim1 in the Operating Point list.
This action will set op_trim1 as the operating point for the frequency response estimation task.
In the Plot Result list, choose Bode Plot 1.

This action will add the next plot to be generated to Bode Plot 1.
Click Estimate.
This action generates a frequency response estimation of the plant that uses in_sine1 as the input signal and op_trim1 as the operating point.
Bode Plot 1 now shows the Bode responses for the estimated plant and the linearized plant.

The magnitude of the Bode responses of the two systems match. However, there is a phase offset.
In the Plot tab, click Current plot properties.

This action launches the Property Editor: Bode Diagram dialog.

Select Adjust phase offsets. Click Close.

Bode Plot 1 is updated.
The frequency estimation response now closely matches the exact linearization.
For frequency-domain validation of linearization, create a sinestream signal. By analyzing one sinusoidal frequency at a time, the software can ignore some of the impact of nonlinear effects.
| Input Signal | Use When | See Also |
|---|---|---|
| Sinestream | All linearization points are on continuous signals. | frest.Sinestream |
| Sinetream with fixed sample time | One or both of the linearization points are on a discrete signal | frest.createFixedTsSinestream |
You can easily create a sinestream signal based on your linearized model. The software uses the linearized model characteristics to accurately predict the number of sinusoid cycles at each frequency to reach steady state.
When diagnosing the frequency response estimation, you can use the sinestream signal to determine whether the time series at each frequency reaches steady state.
This example shows how to validate linearization results by comparing the simulated output of the nonlinear model and the linearized model.
Linearize Simulink model.
For example:
sys = 'watertank';
load_system(sys);
sys_io(1)=linio('watertank/PID Controller',1,'in');
sys_io(2)=linio('watertank/Water-Tank System',1,'out','on');
opspec = operspec(sys);
op = findop(sys,opspec);
linsys = linearize(sys,op,sys_io);If you linearized your model in the Linear Analysis Tool, you must export the linear model to the MATLAB workspace.
Create input signal for validation. For example, a step input signal:
input = frest.createStep('Ts',0.1,...
'StepTime',1,...
'StepSize',1e-5,...
'FinalTime',500);Simulate the Simulink model using the input signal.
[~,simout] = frestimate(sys,op,sys_io,input);
simout is the simulated output of the nonlinear model.
Simulate the linear model sys, and compare the time-domain responses of the linear and nonlinear Simulink model.
frest.simCompare(simout,linsys,input)
The step response of the nonlinear model and linearized model are close, which validates that the linearization is accurate.

Increase the amplitude of the step signal from 1.0e-005 to 1.
input = frest.createStep('Ts',0.1,...
'StepTime',1,...
'StepSize',1,...
'FinalTime',500);Repeat the frequency response estimation with the increased amplitude of the input signal, and compare this time response plot to the exact linearization results.
[~,simout2] = frestimate(sys,op,sys_io,input);
frest.simCompare(simout2,linsys,input)
legend('FRESTIMATE results with Custom input',...
'Linear simulation of linsys with Custom input',...
'Location','SouthEast')

The step response of linear system you obtained using exact linearization does not match the step response of the estimated frequency response with large input signal amplitude.
This result indicates that linear model obtained using exact linearization does not behave linearly you begin to deviate from the specified operating point.
For time-domain validation of linearization, use frest.createStep to create a step signal. Use the step signal as an input to frest.simCompare, which compares the simulated output of the nonlinear model and the linearized model.
The step input helps you assess whether the linear model accurately captures the dominant time constants as it goes through the step transients.
The step input also shows whether you correctly captured the DC gain of the Simulink model by comparing the final value of the exact linearization simulation with the frequency response estimation.
![]() | State Order in Linearized Model | Visualize Models | ![]() |

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |