Main Content

Linearize Simulink Block to Uncertain Model

This example shows how to make a Simulink® block linearize to an uncertain variable at the command line. To learn how to specify an uncertain block linearization using the Simulink model editor, seeSpecify Uncertain Linearization for Core or Custom Simulink Blocks.

For this example, open the Simulink modelslexAircraftExample.

mdl ='slexAircraftExample'; open_system(mdl)

Examine the subsystemAircraft Dynamics Model.

subsys = [mdl,'/Aircraft Dynamics Model']; open_system(subsys)

Suppose you want to specify the following uncertain real values for the gain blocksMwandZd.

Mw_unc = ureal(“瓦”,-0.00592,“比例”,50); Zd_unc = ureal('Zd',-63.9979,“比例”,30);

To specify these values as the linearization for these blocks, create aBlockSubsstructure to pass to thelinearizefunction. The field names are the names of the Simulink blocks, and the values are the corresponding uncertain values. Note that in this model, the name of theMwblock isGain4, and the name of theZdblock isGain5.

Mw_name = [subsys,'/Gain4']; Zd_name = [subsys,'/Gain5']; BlockSubs(1).Name = Mw_name; BlockSubs(1).Value = Mw_unc; BlockSubs(2).Name = Zd_name; BlockSubs(2).Value = Zd_unc;

Compute the uncertain linearization.linearizelinearizes the model at operating point specified in the model, making the substitutions specified byBlockSubs. The result is an uncertain state-space model with an uncertain real parameter for each of the two uncertain gains.

sys = linearize(mdl,BlockSubs)
sys = Uncertain continuous-time state-space model with 1 outputs, 1 inputs, 7 states. The model uncertainty consists of the following blocks: Mw: Uncertain real, nominal = -0.00592, variability = [-50,50]%, 1 occurrences Zd: Uncertain real, nominal = -64, variability = [-30,30]%, 1 occurrences Type "sys.NominalValue" to see the nominal value, "get(sys)" to see all properties, and "sys.Uncertainty" to interact with the uncertain elements.

Examine the uncertain model response.

step(sys)

steptakes random samples and provides a sense of the range of responses within the uncertainty of the linearized model.

See Also

(Simulink Control Design)

Related Topics