Main Content

setState

Class: Aero.FixedWing.State
Namespace: Aero

Set state value to Aero.FixedWing.State object

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

These examples show how to set the state value to specified state name.

Set Angle of Attack of Cruise State

Set the angle of attack cruise state.

[C182, CruiseState] = astC182();
CruiseState = setState(CruiseState, "Alpha", deg2rad(5))
CruiseState = 
  State with properties:

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

Set Velocity Components Using Airspeed, Alpha, and Beta

Set the aircraft velocity components using "Airspeed", "Alpha", and "Beta".

[C182, CruiseState] = astC182();
CruiseState = setState(CruiseState, ["Airspeed", "Alpha", "Beta"], [60, deg2rad(1), deg2rad(-0.1)])
CruiseState = 
  State with properties:

                     Mass: 82.2981
                  Inertia: [3×3 table]
          CenterOfGravity: [1.2936 0 0]
         CenterOfPressure: [0.8232 0 0]
              AltitudeMSL: 5000
             GroundHeight: 0
                       XN: 0
                       XE: 0
                       XD: -5000
                        U: 59.9908
                        V: -0.1047
                        W: 1.0471
                 Airspeed: 60
                      Phi: 0
                    Theta: 0
                      Psi: 0
                        P: 0
                        Q: 0
                        R: 0
                    Alpha: 0.0175
                     Beta: -0.0017
                 AlphaDot: 0
                  BetaDot: 0
                   Weight: 2.6488e+03
              AltitudeAGL: 5000
              GroundSpeed: 60
               MachNumber: 0.0547
             BodyVelocity: [59.9908 -0.1047 1.0471]
           GroundVelocity: [59.9908 -0.1047 1.0471]
                       Ug: 59.9908
                       Vg: -0.1047
                       Wg: 1.0471
          FlightPathAngle: 0.0175
              CourseAngle: -0.0017
     InertialToBodyMatrix: [3×3 double]
     BodyToInertialMatrix: [3×3 double]
         BodyToWindMatrix: [3×3 double]
         WindToBodyMatrix: [3×3 double]
    BodyToStabilityMatrix: [3×3 double]
    StabilityToBodyMatrix: [3×3 double]
          DynamicPressure: 3.6866
              Environment: [1×1 Aero.Aircraft.Environment]
            ControlStates: [1×4 Aero.Aircraft.ControlState]
         OutOfRangeAction: "Limit"
         DiagnosticAction: "Warning"
               Properties: [1×1 Aero.Aircraft.Properties]
               UnitSystem: "English (ft/s)"
        TemperatureSystem: "Fahrenheit"
              AngleSystem: "Radians"

Version History

Introduced in R2021a