# Generate a state space matrix of longitudinal dynamics of an aircraft and determine it's transfer function

72 views (last 30 days)
Kashmira Vinay on 8 Nov 2022
Answered: Nagul Meera Shaik on 14 Nov 2023 at 18:06
For Boeing 747 @40,000 ft, certain parameters are assigned. Based on those, we have to find the state space matrix for Longitudinal Dynamics and then transfer that state space matrix into a transfer function.
I have written the following code:
%Aircraft Parameters
Al = 40,000; %Altitude; ft
M = 0.900; %Mach
TAS = 871; %True Air Speed; ft/s
Pd = 222.8; %Dynamic Pressure; lb/ft^2
W = 636,636; %Weight; lb
s = 5,500; %Wing Area; ft^2
b = 196; %Wing Span; ft
c.bar = 27.3; %Wing Chord; ft
CG = 0.25; %x*c.bar
Alpha = 2.4; %Trim Angle of Attack; degree
Ixxs = 1.82 * 10^7; %slug-ft^2
Iyys = 3.31 * 10^7; %slug-ft^2
Izzs = 4.97 * 10^7; %slug-ft^2
Ixzs = -3.50 * 10^5; %slug-ft^2
U1 = 306.261; %m/s
%Longitudinal Derivatives
Xu = -0.0218; %1/s
Xalp = 1.2227; %X alpha; ft/s^2
Zu = -0.0569; %1/s
Zalp = -339.0036; %Z aplha; ft/s^2
Mu = -0.0001; %1/ft.s
Malp = -1.6165; %M alpha; 1/s^2
Malpdot = -0.1425; %M alpha dot; 1/s
Mq = -0.4038; %1/s
Xde = 0; %X delta e; ft/s^2
Zde = -18.3410; %Z delta e; ft/s^2
Mde = -1.2124; %M delta e; 1/s^2
%Lateral Derivatives
Yb = -55.7808; %Y beta; ft/s^2
Lb = -1.2555; %L beta; 1/s^2
Lp = -0.4758; %1/s
Lr = 0.2974; %1/s
Nb = 1.0143; %N beta; 1/s^2
Np = 0.0109; %1/s
Nr = -0.1793; %1/s
Ydr = 3.7187; %Y delta r; ft/s^2
Ldr = 0.2974; %L delta r; 1/s^2
Ndr = -0.4589; %N delta r; 1/s^2
Yda = 0; %Y delta a; ft/s^2
Lda = 0.1850; %L delta a; 1/s^2
Nda = -0.0135; %N delta a; 1/s^2
%'0' Parameters
Xtu = 0;
Zq = 0;
Mtu = 0;
Tetha1 = 0;
Ntb = 0;
Yp = 0;
Yr = 0;
Ntb = 0;
Zalpdot = 0;
%gravitational constant
g = 9.81;
%State Space Matrices for Longitudinal Dynamics
A = [Xu+Xtu Xalp 0 -g*cos(Tetha1);
(Zu/(U1-Zalpdot)) (Zalp/(U1-Zalpdot)) ((Zq+U1)/(U1-Zalpdot)) ((-g*sin(Tetha1))/(U1-Zalpdot));
Mu+Mtu+((Malpdot*Zu)/(U1-Zalpdot)) Malp+((Malpdot*Zalp)/(U1-Zalpdot)) Mq+(Malpdot*(U1+Zq)/(U1-Zalpdot)) (Malpdot*g*sin(Tetha1)/(U1-Zalpdot));
0 0 1 0]
B = [Xde;
(Zde/(U1-Zalpdot));
Mde+((Malpdot*Zde)/(U1-Zalpdot));
0]
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1]
D = [0;0;0;0]
[Nu,Du] = ss2tf(A, B, C, D)
TF = tf(Nu,Du)
However, when I try to run the code I get an error saying

KALYAN ACHARJYA on 8 Nov 2022
Edited: KALYAN ACHARJYA on 8 Nov 2022
If you check the Transfer fuction MATLAB docs, its clearly states that the values of the "Numerator" and "Denominator" properties must be row vectors or cell arrays of row vectors. The same has been reflected in the error message. In your case
clc
Nu=[0 0 -0.0732 10.2980 12.2155
0 -0.0599 -1.2379 -0.0270 -0.0022
0 -1.2039 -1.2715 -0.0274 0
0 0 -1.2039 -1.2715 -0.0274]
Nu = 4×5
0 0 -0.0732 10.2980 12.2155 0 -0.0599 -1.2379 -0.0270 -0.0022 0 -1.2039 -1.2715 -0.0274 0 0 0 -1.2039 -1.2715 -0.0274
Du =[1.0000 1.6750 2.0997 0.0445 0.0019]
Du = 1×5
1.0000 1.6750 2.0997 0.0445 0.0019
Hence error
TF = tf(Nu,Du)
Error using tf
The values of the "Numerator" and "Denominator" properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing numeric data. Type "help tf.num" or "help
For Testing case lets change the Nu to row vector
Nu=[0 0 -0.0732 10.2980 12.2155]
Du=[1.0000 1.6750 2.0997 0.0445 0.0019]
TF =
-0.0732 s^2 + 10.3 s + 12.22
-----------------------------------------------
s^4 + 1.675 s^3 + 2.1 s^2 + 0.04448 s + 0.00186
Continuous-time transfer function.

Nagul Meera Shaik on 14 Nov 2023 at 18:06
CAN YOU SHOW WHAT MATRIX FORM HAVE YOU USED FOR SAME QUESTION FOR LATERAL DYNAMICS