Main Content

setState

Class: Aero.FixedWing.State
Namespace: Aero

Set state value to Aero.FixedWing.State object

Since R2021a

Syntax

state = setState(state,statename,value)

Description

state = setState(state,statename,value) sets the state value to a specified state name value.

Input Arguments

expand all

Aero.FixedWing.State object, specified as a scalar.

State names, specified in a vector. You cannot set effective control variables created with asymmetric control surfaces. For more information on state names, see the Aero.FixedWing.State Properties.

Tip

Each vector of statename and value must be the same length.

Data Types: char | string

State values, specified as a vector.

  • If the states are all scalar constants, value is a numeric vector.

  • If one of more states are not scalar constants, value is a cell vector.

Tip

Each vector of statename and value must be the same length.

Output Arguments

expand all

Modified input object with the modified states at the specified locations.

Examples

expand all

Set the pitch angle of a cruise state.

[C182, CruiseState] = astC182();
CruiseState = setState(CruiseState, "Alpha", 5)
CruiseState = 

  State with properties:

                   Alpha: NaN
                    Beta: NaN
                AlphaDot: 0
                 BetaDot: 0
                    Mass: 82.2981
                 Inertia: [3×3 table]
         CenterOfGravity: [1.2936 0 0]
        CenterOfPressure: [1.2250 0 0]
             AltitudeMSL: 5000
            GroundHeight: 0
                      XN: 0
                      XE: 0
                      XD: -5000
                       U: 220.1000
                       V: 0
                       W: 0
                     Phi: 0
                   Theta: 0
                     Psi: 0
                       P: 0
                       Q: 0
                       R: 0
                  Weight: 2.6500e+03
             AltitudeAGL: 5000
                Airspeed: NaN
             GroundSpeed: 220.1000
              MachNumber: NaN
            BodyVelocity: [NaN NaN NaN]
          GroundVelocity: [220.1000 0 0]
                      Ur: NaN
                      Vr: NaN
                      Wr: NaN
         FlightPathAngle: 0
             CourseAngle: 0
    InertialToBodyMatrix: [3×3 double]
    BodyToInertialMatrix: [3×3 double]
        BodyToWindMatrix: [3×3 double]
        WindToBodyMatrix: [3×3 double]
         DynamicPressure: NaN
             Environment: [1×1 Aero.Aircraft.Environment]
              UnitSystem: "English (ft/s)"
             AngleSystem: "Radians"
       TemperatureSystem: "Fahrenheit"
           ControlStates: [1×4 Aero.Aircraft.ControlState]
        OutOfRangeAction: "Limit"
        DiagnosticAction: "Warning"
              Properties: [1×1 Aero.Aircraft.Properties]

Set the U, V, and W velocity components of a cruise state.

[C182, CruiseState] = astC182();
CruiseState = setState(CruiseState, ["U", "V", "W"], [50, 1, 10])
CruiseState = 

  State with properties:

                   Alpha: 0.1974
                    Beta: 0.0196
                AlphaDot: 0
                 BetaDot: 0
                    Mass: 82.2981
                 Inertia: [3×3 table]
         CenterOfGravity: [1.2936 0 0]
        CenterOfPressure: [1.2250 0 0]
             AltitudeMSL: 5000
            GroundHeight: 0
                      XN: 0
                      XE: 0
                      XD: -5000
                       U: 50
                       V: 1
                       W: 10
                     Phi: 0
                   Theta: 0
                     Psi: 0
                       P: 0
                       Q: 0
                       R: 0
                  Weight: 2.6500e+03
             AltitudeAGL: 5000
                Airspeed: 51
             GroundSpeed: 51
              MachNumber: 0.0465
            BodyVelocity: [50 1 10]
          GroundVelocity: [50 1 10]
                      Ur: 50
                      Vr: 1
                      Wr: 10
         FlightPathAngle: 0.1974
             CourseAngle: 0.0200
    InertialToBodyMatrix: [3×3 double]
    BodyToInertialMatrix: [3×3 double]
        BodyToWindMatrix: [3×3 double]
        WindToBodyMatrix: [3×3 double]
         DynamicPressure: 2.6639
             Environment: [1×1 Aero.Aircraft.Environment]
              UnitSystem: "English (ft/s)"
             AngleSystem: "Radians"
       TemperatureSystem: "Fahrenheit"
           ControlStates: [1×4 Aero.Aircraft.ControlState]
        OutOfRangeAction: "Limit"
        DiagnosticAction: "Warning"
              Properties: [1×1 Aero.Aircraft.Properties]

Version History

Introduced in R2021a