Contents

setxu

Set states and inputs in operating points

Syntax

op_new=setxu(op_point,x,u)

Alternatives

As an alternative to the setxu function, set states and inputs of operating points with the Simulink® Control Design™ GUI.

Description

op_new=setxu(op_point,x,u) sets the states and inputs in the operating point, op_point, with the values in x and u. A new operating point containing these values, op_new, is returned. The variable x can be a vector or a structure with the same format as those returned from a Simulink simulation. The variable u can be a vector. Both x and u can be extracted from another operating point object with the getxu function.

Examples

expand all

Initialize Operating Point Object Using State Values from Simulation

Export state values from a simulation and use the exported values to initialize an operating point object.

Open the Simulink model. This example uses the model scdplane.

open_system('scdplane')

Select Simulation > Model Configuration Parameters. In the Configuration Parameters dialog box, select Data Import/Export. In the Save to workspace pane, select Final states. Click OK. These selections save the final states of the model to the workspace after a simulation.

Simulate the model. After the simulation, a new variable, xFinal, appears in the workspace. This variable is a vector containing the final state values.

Create an operating point object for scdplane.

op_point = operpoint('scdplane')
 Operating Point for the Model scdplane.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) scdplane/Actuator Model
      x: 0            
(2.) scdplane/Aircraft Dynamics Model/Transfer Fcn.1
      x: 0            
(3.) scdplane/Aircraft Dynamics Model/Transfer Fcn.2
      x: 0            
(4.) scdplane/Controller/Alpha-sensor Low-pass Filter
      x: 0            
(5.) scdplane/Controller/Pitch Rate Lead Filter
      x: 0            
(6.) scdplane/Controller/Proportional plus integral compensator
      x: 0            
(7.) scdplane/Controller/Stick Prefilter
      x: 0            
(8.) scdplane/Dryden Wind Gust Models/Q-gust model
      x: 0            
(9.) scdplane/Dryden Wind Gust Models/W-gust model
      x: 0            
      x: 0            

Inputs: 
----------
(1.) scdplane/u
      u: 0    

All states are initially set to 0.

Initialize the states in the operating point object to the values in xFinal. Set the input to be 9.

newop = setxu(op_point,xFinal,9)
 Operating Point for the Model scdplane.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) scdplane/Actuator Model
      x: -0.032       
(2.) scdplane/Aircraft Dynamics Model/Transfer Fcn.1
      x: 0.56         
(3.) scdplane/Aircraft Dynamics Model/Transfer Fcn.2
      x: 678          
(4.) scdplane/Controller/Alpha-sensor Low-pass Filter
      x: 0.392        
(5.) scdplane/Controller/Pitch Rate Lead Filter
      x: 0.133        
(6.) scdplane/Controller/Proportional plus integral compensator
      x: 0.166        
(7.) scdplane/Controller/Stick Prefilter
      x: 0.1          
(8.) scdplane/Dryden Wind Gust Models/Q-gust model
      x: 0.114        
(9.) scdplane/Dryden Wind Gust Models/W-gust model
      x: 0.46         
      x: -2.05        

Inputs: 
----------
(1.) scdplane/u
      u: 9    
Was this topic helpful?