Example: Modeling a Pitch Controller

Physical setup and system equations
Design requirements
Transfer function and state-space
Matlab representation and open-loop response
Closed-loop transfer function

## Physical setup and system equations

The equations governing the motion of an aircraft are a very complicated set of six non-linear coupled differential equations. However, under certain assumptions, they can be decoupled and linearized into the longitudinal and lateral equations. Pitch control is a longitudinal problem, and in this example, we will design an autopilot that controls the pitch of an aircraft.

The basic coordinate axes and forces acting on an aircraft are shown in the figure below:

Assume that the aircraft is in steady-cruise at constant altitude and velocity; thus, the thrust and drag cancel out and the lift and weight balance out each other. Also, assume that change in pitch angle does not change the speed of an aircraft under any circumstance (unrealistic but simplifies the problem a bit). Under these assumptions, the longitudinal equations of motion of an aircraft can be written as:

(1)

Please refer to any aircraft-related textbooks for the explanation of how to derive these equations. Also, click Variables to see what each variable represents.

For this system, the input will be the elevator deflection angle, and the output will be the pitch angle.

## Design requirements

The next step is to set some design criteria. We want to design a feedback controller so that the output has an overshoot of less than 10%, rise time of less than 2 seconds, settling time of less than 10 seconds, and the steady-state error of less than 2%. For example, if the input is 0.2 rad (11 degress), then the pitch angle will not exceed 0.22 rad, reaches 0.2 rad within 2 seconds, settles 2% of the steady-state within 10 seconds, and stays within 0.196 to 0.204 rad at the steady-state.

• Overshoot: Less than 10%
• Rise time: Less than 2 seconds
• Settling time: Less than 10 seconds
• Steady-state error: Less than 2%

## Transfer function and the state-space

Before finding transfer function and the state-space model, let's plug in some numerical values to simplify the modeling equations (1) shown above.

(2)

These values are taken from the data from one of the Boeing's commercial aircraft.

### 1. Transfer function

To find the transfer function of the above system, we need to take the Laplace transform of the above modeling equations (2). Recall from your control textbook, when finding a transfer function, zero initial conditions must be assumed. The Laplace transform of the above equations are shown below.

After few steps of algebra, you should obtain the following transfer function.

### 2. State-space

Knowing the fact that the modeling equations (2) are already in the state-variable form, we can rewrite them into the state-space model.

Since our output is the pitch angle, the output equation is:

## Matlab representation and open-loop response

Now, we are ready to observe the system characteristics using Matlab. First, let's obtain an open-loop system to a step input and determine which system characteristics need improvement. Let the input (delta e) be 0.2 rad (11 degrees). Create an new m-file and enter the following commands.

```
de=0.2;

num=[1.151 0.1774];
den=[1 0.739 0.921 0];

step (de*num,den)
```
Running this m-file in the Matlab command window should give you the following plot.

From the plot, we see that the open-loop response does not satisfy the design criteria at all. In fact the open-loop response is unstable.

If you noticed, the above m-file uses the numerical values from the transfer function. To use the state-space model, enter the following commands into a new m-file (instead of the one shown above) and run it in the command window.

```
de=0.2;

A=[-0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0];
B=[0.232; 0.0203; 0];
C=[0 0 1];
D=[0];

step(A,B*de,C,D)
```
You should get the same response as the one shown above.

Note: It is possible to convert from the state-space to transfer function, or vice versa using Matlab. To learn more about conversions, see Conversions

## Closed-loop transfer function

To solve this problem, a feedback controller will be added to improve the system performance. The figure shown below is the block diagram of a typical unity feedback system.

A controller needs to be designed so that the step response satisfies all design requirements. Four different methods to design a controller are listed at the bottom of this page. You may choose: PID, Root-locus, Frequency response, or State-space.