File Exchange

image thumbnail


version (155 KB) by Giampiero Campa
The Aircraft Library


Updated 02 Jan 2019

View Version History

View License

Airlib is a library of aircraft models to be used with Simulink 3.1 (MATLAB 5.3) or later (tested until 2018a).

It is based on two basic blocks that implement a continuous-time and a discrete-time nonlinear general aircraft model.
The initial version, dated Feb 2003, contains 13 different nonlinear aircraft models including, among others, a Boeing 747, an F4 Phantom, an F104 Starfighter, an X15, an IAI Pioneer (unmanned), a Convair 880 and four different Cessna models.

Each model is a link to one of the two library blocks, but of course with different parameters on the mask. Indeed, the type of aircraft is entirely specified by the inertial and aerodynamic parameters typed on the mask, which also includes a very detailed help that describes the meaning of inputs, states, outputs and mask parameters.

An example showing a Boeing 747 in a (closed loop) straight and level flight is also given.

In May 2003 a very effective MATLAB function (air3m.m) was added to allow the user to easily trim any given aircraft for any combination of desired speed, altitude, and flight path angle.

In March 04, a function that computes the aerodynamic derivatives from the linear model matrices was added, together with a Simulink model that compares two different ways of handling the wind in the equations of motions.

In July 2006 a full guidance and control system based on the feedback linearization of the aircraft kinematic and dynamics was added. The scheme includes a waypoint generation system, and can be easily adapted to any aircraft with known aerodynamics coefficients.

Please have a look to the readme.txt file for more detailed info.
Giampiero Campa, March 2004

Cite As

Giampiero Campa (2021). Airlib (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (28)

Rishabh Jaiswal

How to define Alg and Blg [longitudinal Matrix] ???????

How to convert CFD data into the stability controls derivatives and how to create own Aircraft Model in terms of control derivative???????

Giampiero Campa

Many of the coefficients for the aerodynamics of the different aircraft are taken from here:, with the original source being: Roskam, J., Airplane Flight Dynamics and Automatic Flight Controls, Part I, DARcorporation, Lawrence, KS, 1995.

Giampiero Campa

The equations for the nonlinear models are fully described here:


Thanks a lot for sharing this work

Prasannajit Dash

Giampiero Campa

I have no idea, maybe try another computer if you can. Feel free to send me an email.

Akan Güven

Nope, even if I write the code as you shown, it does not work. Please help, I kind of stucked here. I want to trim my B747 at steady state flight level for given Va (airspeed) and Altitude while gamma = 0 rad. Appreciate you.. I have matlab v 2019 b. Can you write step by step what to do, the codes to use air3m.m for trimming my aircraft. Thank you with all my respect, kind regards

Giampiero Campa

I have never ran into an out of memory error. I suspect there's something with your computer setup.
Does this work for you: [x0,u0]=air3m('airtrim',260,100,0);
If yes, go from there by making small modifications to airtrim.mdl

Akan Güven

when I try to run it, it throws an error such below:

>> air3m
Out of memory. The likely cause is an infinite recursion within the program.

Error in air3m (line 17)



Thanks a lot for helping.

Giampiero Campa

Those are earth fixed frame coordinates, (and the last 3 state variables, so their initial value is specified by the initial condition parameter in the mask). The last one (#12) actually should be called H instead of ze, it is the altitude and points up. I'm pretty sure xe points north and ye points east. You can download the PDF manual of the FDC toolbox (on which Airlib is based) here:


Thanks a lot for helping.
What should be
10 xe (m) =?
11 ye (m) =?
12 ze (m) = Altitude

Giampiero Campa

If you double click on the green block called "Signals" (either in the B747 closed loop example or inside the General Aircraft Model) mask there is a list. I'll copy and paste it for your benefit:

01 v (m/s)
02 alpha (rad)
03 beta (rad)
04 p (rad/s)
05 q (rad/s)
06 r (rad/s)
07 psi (rad)
08 theta (rad)
09 phi (rad)
10 xe (m)
11 ye (m)
12 ze (m)
13 v dot (m/s2)
14 alpha dot (rad/s)
15 beta dot (rad/s)
16 p dot (rad/s2)
17 q dot (rad/s2)
18 r dot (rad/s2)
19 fi dot (rad/s)
20 theta dot (rad/s)
21 psi dot (rad/s)
22 xe dot (m/s)
23 ye dot (m/s)
24 ze dot (m/s)
25 u dot (m/s2)
26 v dot (m/s2)
27 w dot (m/s2)
28 pb/2v (rad)
29 qc/v (rad)
30 rb/v (rad)
31 Ax (g)
32 Ay (g)
33 Az (g)
34 ax (g)
35 ay (g)
36 az (g)
37 delta elevators (rad)
38 delta ailerons (rad)
39 delta rudder (rad)
40 delta stabs (rad)


Thank you for answering. I need to ask one more question. I just know 9 parameters with scope.
1-Airspeed, 2-Angle of Attack, 3-Sideslip Angle, 4-Roll Rate, 5- Pitch Rate, 6- Yaw Rate, 7-Yaw Angle, 8- Pitch Angle, 9- Roll Angle.
Could you tell me please? what rest of the 31 parameters are. Thank you.

Giampiero Campa

Ugur, the model is nonlinear in nature so it can handle different conditions already (i.e. steep turns and maneuvers and even some climbs and descents). However, the aerodynamic forces are linearized around the operating condition, so if you want to handle full flight with climbs to a condition far from the original point you have to update the aerodynamic coefficients as you move along. You need to create a lookup table for each parameter and replace simple multiplications with a constant parameter inside the model with multiplication with something you get from the lookup table. It's doable but it requires some work.


Hello good work. How can I get full flight of 747 instead of level flight? I mean takeoff, climb, cruise, descend and landing.
Thank you for answersing.

Ryan Hoffman


Giampiero Campa

You can fix 3D visualization in the general controller model for versions 2014b and later by deleting the sfunxyz.m file and installing 3Dscope:

zhao mask

Giampiero Campa

Note that the general controller model features also a (non essential) 3D scope which does not work properly for 2014b and later versions. I will try to fix it at some point. If you need it sooner rather than later please let me know.

ying wong



Dear Giampiero Campa,

Do you have some documentation or something to help the understand your model?

Tiago Cariolano

hasan bafayad

i just need to solve the boing 747 for
control and stability i hope it's usefull for me

az bew

I look for aircraft Pilatus-9M !

aaa ddd

tariq abrass

very good

Nyan Tun

MATLAB Release Compatibility
Created with R11.1
Compatible with R11.1 and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!