## Gain block XFIX

XFIX is a standard Simulink gain-block, which is used in the subsystem Aircraft Equations of Motion (level 3) of the aircraft model Beaver to artificially fix states to their initial values.

The value of the constant xfix needs to be defined in the Matlab workspace before starting a simulation or any other evaluation of the Beaver model; the utility FIXSTATE can be used to assist in this definition.

### Why artificially fix state variables?

Artificially fixing state variables to their initial values means that one deliberately eliminates certain couplings from the simulation model. This may for instance be useful if you want to assess the aircraft's longitudinal and lateral motions independently from eachother (thus deliberatly neglecting the cross-coupling effects), or to implement the 'ideal' control-behavior (e.g. pitch attitude hold or speed hold) against which a practical control system should be measured.

### How does it work?

The gain XFIX multiplies the vector with time-derivatives of the state variables, xdot, with the gain-factor xfix. If the user does not impose artificial restrictions upon the states, xfix will be equal to one, and the outputvector from XFIX is equal to xdot, according to the equations of motion. The same result is obtained when the constant xfix is equal to a vector of length 12 with elements that are all equal to one.

If, however, the user wants to fix some of the twelve states to their initial values, xfix needs to be equalled to a vector of length 12 with elements that are all equal to one, except for the element numbers that correspond with the states to be fixed. If, for instance, the user wants to fix the first, fifth, and last states to their initial values, the first, fifth, and last element of xfix must be set to zero. In that case, the input/output structure around the block XFIX looks like:

    xdot_in = [V dot;      \            /  xdot_out = [ 0
               alpha dot;  |            |              alpha dot;
               beta dot;   |            |              beta dot;
               p dot;      |            |              p dot;
               q dot;      |            |               0
               r dot;      |            |              r dot;
               psi dot;    |> * xfix   <|              psi dot;
               theta dot;  |            |              theta dot;
               phi dot;    |            |              phi dot;
               xe dot;     |            |              xe dot;
               ye dot;     |            |              ye dot;
               H dot]      /            \               0 ]

Since the first, fifth, and last elements of xdot are artificially set to zero, the corresponding states will equal their initial values until the value of xfix is changed again!

If the variable xfix is not present in the workspace when the aircraft model is accessed by e.g. a simulation or a linearization process, it will automatically be set to `ones(1,12)`. Run FIXSTATE if you want to change this default definition of xfix.