diff options
author | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
---|---|---|
committer | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
commit | b4b6aa36e3486a3544acc52419149b5671f841e9 (patch) | |
tree | 66c1783158f23e6d21c77324156fc57e18d4ac67 /Prof_Arya/Comp_LinMod.m | |
parent | f5266f634f4fb4fd39933a83551a01cf446256b8 (diff) | |
download | OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.gz OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.bz2 OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.zip |
Diffstat (limited to 'Prof_Arya/Comp_LinMod.m')
-rw-r--r-- | Prof_Arya/Comp_LinMod.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Prof_Arya/Comp_LinMod.m b/Prof_Arya/Comp_LinMod.m new file mode 100644 index 0000000..861e759 --- /dev/null +++ b/Prof_Arya/Comp_LinMod.m @@ -0,0 +1,32 @@ +[A, B, C, D] = linmod('Cessna_6DOF_trim');
+
+A = [A(1,1) A(1,3) A(1,5) A(1,11);
+ A(3,1) A(3,3) A(3,5) A(3,11);
+ A(5,1) A(5,3) A(5,5) A(5,11);
+ A(11,1) A(11,3) A(11,5) A(11,11)];
+
+B = [B(1,1) B(1,4);
+ B(3,1) B(3,4);
+ B(5,1) B(5,4);
+ B(11,1) B(11,4)];
+
+X(1:4,1) = [u, w, theta, q];
+
+for kk = 1:10/0.001
+
+ X(:,kk+1) = X(:,kk) + (A*(X(:,kk) - X(:,1)) + B*[(U(kk,1) + 0.0303) 0]')*0.001;
+
+end
+
+plot(X(1,:))
+hold on
+plot(V_arr.*cos(alpha_arr),'--')
+legend('Linearized','Nonlinear')
+xlabel('u (m/s)')
+
+figure
+plot(X(2,:))
+hold on
+plot(alpha_arr*180/pi,'--')
+legend('Linearized','Nonlinear')
+xlabel('alpha (degree)')
\ No newline at end of file |