├── 2018-2019_AVDC_AVCS_Assignemnt.pdf ├── Main.m ├── Main_Simulink.slx ├── Main_Simulink.slxc ├── Question_3.slx ├── Question_3.slxc ├── README.md ├── Single Modules ├── Cell_II_1_1_A.m ├── Cell_II_1_1_B.m ├── Cell_II_1_2_A.m ├── Cell_II_1_2_A_conn.asv ├── Cell_II_1_2_B.m ├── Cell_II_2_1_A.m ├── Cell_II_2_1_B.m ├── Cell_II_2_1_C.m ├── Cell_II_2_1_D.m ├── Cell_II_2_1_E.m └── Cell_II_2_1_F.m ├── Untitled.mat ├── img ├── bode_Nom_Unc.svg ├── bode_mag_weights.svg ├── inner_step.JPG ├── inner_step_unc.svg ├── inner_step_updated.JPG └── missile.JPG └── slprj └── sim └── varcache ├── Main_Simulink ├── checksumOfCache.mat ├── tmwinternal │ └── simulink_cache.xml └── varInfo.mat └── Question_3 ├── checksumOfCache.mat ├── tmwinternal └── simulink_cache.xml └── varInfo.mat /2018-2019_AVDC_AVCS_Assignemnt.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/2018-2019_AVDC_AVCS_Assignemnt.pdf -------------------------------------------------------------------------------- /Main.m: -------------------------------------------------------------------------------- 1 | %% ================================================================================================== 2 | % Cell for Question 1.1 a): Creating the System Model for the nominal and the uncertain System 3 | %% ================================================================================================== 4 | 5 | %====== Nominal Model 6 | %Defining Variables[M,Delta] = lftdata(Gss_af) 7 | 8 | Z_alpha=-1231.914; 9 | M_q=0; 10 | Z_delta=-107.676; 11 | A_alpha=-1429.131; 12 | A_delta=-114.59; 13 | V=947.684; 14 | g=9.81; 15 | omega_a=150; 16 | zeta_a=0.7; 17 | 18 | %uncertain parameters 19 | M_alpha=-299.26; 20 | M_delta=-130.866; 21 | 22 | %%Defining the Actuator System Matrices 23 | A_ac_n= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 24 | B_ac_n= [ (0); (omega_a^2)]; 25 | C_ac_n= [ (1) 0]; 26 | D_ac_n= 0; 27 | 28 | %Creating State Space System Model 29 | Gss_ac_n = ss(A_ac_n,B_ac_n,C_ac_n,D_ac_n,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 30 | 31 | 32 | % Defining the Airframe System Matrices 33 | A_af_n= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 34 | B_af_n= [ (Z_delta/V); (M_delta)]; 35 | C_af_n= [ (A_alpha/g) 0 ; 36 | 0 1 ]'; 37 | D_af_n= [A_delta/g 0]'; 38 | 39 | %Creating State Space System Model 40 | Gss_af_n = ss(A_af_n,B_af_n,C_af_n,D_af_n,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 41 | 42 | 43 | % Defining the Sesnsor System Matrices 44 | A_se_n= [0 0; 0 0]; 45 | B_se_n= [0 0; 0 0]; 46 | C_se_n= [0 0;0 0]; 47 | D_se_n= [1 0; 0 1]; 48 | 49 | Gss_se_n = ss(A_se_n,B_se_n,C_se_n,D_se_n,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 50 | 51 | %%Combining the Models 52 | T_n = connect(Gss_af_n,Gss_ac_n,Gss_se_n,'\delta_q_c',{'a_z_m','q_m'}); 53 | 54 | %computing poles 55 | p_n= pole(T_n) 56 | 57 | %computing zeros 58 | z_n = zero(T_n) 59 | 60 | %computing daming of nominal model 61 | eig(T_n); 62 | damp(T_n); 63 | 64 | % Creating and Saving Plots 65 | % saving directory 66 | mkdir('./img/Cell_1_1_A'); 67 | 68 | %step response of nominal system 69 | figure 70 | step(T_n) 71 | title("Step Response - Nominal System"); 72 | print('./img/Cell_1_1_A/Step_Nom','-dsvg'); 73 | 74 | %impulse response of nominal system 75 | figure 76 | impulse(T_n) 77 | title("Impulse Response - Nominal System"); 78 | print('./img/Cell_1_1_A/Impulse_Nom','-dsvg'); 79 | 80 | % Bode plot of nominal system 81 | figure 82 | bode(T_n) 83 | title("Bode Diagram - Uncertain System"); 84 | print('./img/Cell_1_1_A/Bode_Un','-dsvg'); 85 | 86 | %impulse response of uncertain system 87 | figure 88 | nyquist(T_n) 89 | title("Nyquist Diagram - Nominal System"); 90 | print('./img/Cell_1_1_A/Nyquist_Nom','-dsvg'); 91 | 92 | 93 | %ploting the poles and zeros 94 | figure 95 | iopzplot(T_n(1)); 96 | title("Z-Plane Diagram - Nominal System a_z"); 97 | print('./img/Cell_1_1_A/ZPlane_a_z_Nom','-dsvg'); 98 | 99 | %ploting the poles and zeros 100 | figure 101 | iopzplot(T_n(2)); 102 | title("Z-Plane Diagram - Nominal System q"); 103 | print('./img/Cell_1_1_A/ZPlane_q_Nom','-dsvg'); 104 | 105 | 106 | %%%======================================================================== 107 | %%%======================================================================== 108 | 109 | %====== Uncertain Model 110 | 111 | % Defining Variables 112 | Z_alpha=-1231.914; 113 | M_q=0; 114 | Z_delta=-107.676; 115 | A_alpha=-1429.131; 116 | A_delta=-114.59; 117 | V=947.684; 118 | g=9.81; 119 | omega_a=150; 120 | zeta_a=0.7; 121 | r_M_alpha=57.813; 122 | r_M_delta=32.716; 123 | 124 | % Uncertain parameters 125 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 126 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 127 | 128 | %Defining the Actuator System Matrices of Actuators 129 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 130 | B_ac= [ (0); (omega_a^2)]; 131 | C_ac= [ (1); 0]'; 132 | D_ac= 0; 133 | 134 | % Creating State Space System Model 135 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 136 | 137 | % Defining the Airframe System Matrices 138 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 139 | B_af= [ (Z_delta/V); (M_delta)]; 140 | C_af= [ (A_alpha/g) 0 ; 141 | 0 1 ]'; 142 | D_af= [A_delta/g 0]'; 143 | 144 | % Creating State Space System Model of Airframe 145 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 146 | 147 | 148 | % Defining the Sesnsor System Matrices 149 | A_se= [0 0; 0 0]; 150 | B_se= [0 0; 0 0]; 151 | C_se= [0 0;0 0]; 152 | D_se= [1 0; 0 1]; 153 | 154 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 155 | 156 | 157 | %Combining the Models 158 | T1 = connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'}); 159 | 160 | % computing daming of unvertain model 161 | eig(T1); 162 | damp(T1); 163 | 164 | 165 | % Creating and Saving Plots 166 | 167 | % step response of uncertain system 168 | figure 169 | step(T1) 170 | title("Step Response - Uncertain System"); 171 | print('./img/Cell_1_1_A/Step_Un','-dsvg'); 172 | 173 | % impulse response of unvertain system 174 | figure 175 | impulse(T1) 176 | title("Impulse Response - Uncertain System"); 177 | print('./img/Cell_1_1_A/Impulse_Un','-dsvg'); 178 | 179 | % Bode plot 180 | figure 181 | bode(T1) 182 | title("Bode Diagram - Uncertain System"); 183 | print('./img/Cell_1_1_A/Bode_Un','-dsvg'); 184 | 185 | % nyquist plot 186 | figure 187 | nyquist(T1) 188 | title("Nyquist Diagram - Uncertain System"); 189 | print('./img/Cell_1_1_A/Nyquist_Un','-dsvg'); 190 | 191 | 192 | % ploting the poles and zeros 193 | %for output az 194 | figure 195 | iopzplot(T1(1)); 196 | title("Z-Plane Diagram - Uncertain System a_z"); 197 | print('./img/Cell_1_1_A/ZPlane_az_Un','-dsvg'); 198 | 199 | %for output q 200 | figure 201 | iopzplot(T1(2)); 202 | title("Z-Plane Diagram - Uncertain System q"); 203 | print('./img/Cell_1_1_A/ZPlane_q_Un','-dsvg'); 204 | 205 | % legend('RMSE', 'CRLB') 206 | % title('EKF RMSE (m)') 207 | % xlabel('Time step') 208 | % ylabel('RMSE (m)') 209 | % print('./Graphs/EKF','-dsvg') 210 | 211 | 212 | %% ================================================================================================== 213 | %Cell for Question 1.1 b): LFT model 214 | %% ================================================================================================== 215 | 216 | %====== Uncertain Model 217 | 218 | % Defining Variables 219 | Z_alpha=-1231.914; 220 | M_q=0; 221 | Z_delta=-107.676; 222 | A_alpha=-1429.131; 223 | A_delta=-114.59; 224 | V=947.684; 225 | g=9.81; 226 | omega_a=150; 227 | zeta_a=0.7; 228 | r_M_alpha=57.813; 229 | r_M_delta=32.716; 230 | 231 | % Uncertain parameters 232 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 233 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 234 | 235 | % Defining the Airframe System Matrices 236 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 237 | B_af= [ (Z_delta/V); (M_delta)]; 238 | C_af= [ (A_alpha/g) 0 ; 239 | 0 1 ]'; 240 | D_af= [A_delta/g 0]'; 241 | 242 | % Creating State Space System Model of Airframe 243 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 244 | 245 | % Decomposing Uncertain Objects Decomposing Uncertain Objects 246 | [M,Delta,BLK] = lftdata(Gss_af) 247 | 248 | % LFT State Space System 249 | LFT = ss(M); 250 | 251 | %Simplify 252 | ssLFT=simplify(LFT,'full') 253 | 254 | % Validation: Theoreticly Expected Matrices 255 | A_est= [ (Z_alpha/V) 1 ; (M_alpha.NominalValue) (M_q)]; 256 | B_est= [ 0 0 (Z_delta/V); 257 | sqrt(-M_alpha.NominalValue*(r_M_alpha/100)) sqrt(-M_delta.NominalValue*(r_M_delta/100)) M_delta.NominalValue]; 258 | C_est= [ sqrt(-M_alpha.NominalValue*(r_M_alpha/100)) 0 ; 259 | 0 0 ; 260 | (A_alpha/g) 0 ; 261 | 0 1 ]; 262 | D_est= [ 0 0 0 ; 263 | 0 0 sqrt(-M_delta.NominalValue*(r_M_delta/100)); 264 | 0 0 (A_delta/g) ; 265 | 0 0 0 ]; 266 | 267 | % Comparision with compute H matrix elements (Succesful validation: All matrix elements equals zero) 268 | Zero_A= A_est-ssLFT.A 269 | Zero_B= B_est-ssLFT.B 270 | Zero_C= C_est-ssLFT.C 271 | Zero_D= D_est-ssLFT.D 272 | 273 | %% ================================================================================================== 274 | % Cell for Question 1.2 a): Uncertain inner loop state space model 275 | %% ================================================================================================== 276 | 277 | % Step : Inner Loop Gain 278 | % Defining Variables 279 | Z_alpha=-1231.914; 280 | M_q=0; 281 | Z_delta=-107.676; 282 | A_alpha=-1429.131; 283 | A_delta=-114.59; 284 | V=947.684; 285 | g=9.81; 286 | omega_a=150; 287 | zeta_a=0.7; 288 | r_M_alpha=57.813; 289 | r_M_delta=32.716; 290 | 291 | % Uncertain parameters 292 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 293 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 294 | 295 | %Defining the Actuator System Matrices of Actuators 296 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 297 | B_ac= [ (0); (omega_a^2)]; 298 | C_ac= [ (1); 0]'; 299 | D_ac= 0; 300 | 301 | % Creating State Space System Model 302 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 303 | 304 | % Defining the Airframe System Matrices 305 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 306 | B_af= [ (Z_delta/V); (M_delta)]; 307 | C_af= [ (A_alpha/g) 0 ; 308 | 0 1 ]'; 309 | D_af= [A_delta/g 0]'; 310 | 311 | % Creating State Space System Model of Airframe 312 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 313 | 314 | 315 | % Defining the Sesnsor System Matrices 316 | A_se= [0 0; 0 0]; 317 | B_se= [0 0; 0 0]; 318 | C_se= [0 0;0 0]; 319 | D_se= [1 0; 0 1]; 320 | 321 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 322 | 323 | % %%Definition of inner loop Gain Kq 324 | K_q = tunableGain('K_q',1,1); 325 | K_q.Gain.Value = -0.25;%-0.165;%0.00782; %0.00782 326 | K_q.InputName = 'e_q'; 327 | K_q.OutputName = '\delta_q_c'; 328 | 329 | 330 | % LTI GAIN system for simulink 331 | K_q_sim=tf(-0.165); % -0.165 for q_m found via rlocus 332 | K_q_sim.Inputname = 'e_q'; 333 | K_q_sim.OutputName = '\delta_q_c'; 334 | 335 | 336 | 337 | %Summing junction 338 | Sum = sumblk('e_q = q_c - q_m'); 339 | 340 | % Open Loop System 341 | T_open = ss(connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'})); 342 | 343 | % Open Loop Response Analysis 344 | 345 | % Saving Plotsin directory 346 | mkdir('./img/Cell_1_2_A'); 347 | 348 | % Nyquist - Uncertain 349 | figure 350 | nyquist(T_open(1)) 351 | hold on 352 | nyquist(-T_open(1)) 353 | title("Open Loop Root Locus - Uncertain System"); 354 | print('./img/Cell_1_2_A/open_nyquist_unc','-dsvg'); 355 | 356 | % Nyquist - nominal 357 | figure 358 | nyquist(ss(T_open(1))) 359 | hold on 360 | nyquist(ss(-T_open(1))) 361 | title("Open Loop Root Locus - Uncertain System"); 362 | print('./img/Cell_1_2_A/open_nyquist_nom','-dsvg'); 363 | 364 | % Root Locus - Uncertain 365 | figure 366 | rlocus(T_open(1)) 367 | zeta=0.707 368 | sgrid(zeta,20000) 369 | title("Open Loop Root Locus - Uncertain System"); 370 | print('./img/Cell_1_2_A/open_rlocus_unc','-dsvg'); 371 | 372 | % Root Locus - Nominal 373 | figure 374 | rlocus(ss(T_open(1))) 375 | zeta=0.707 376 | sgrid(zeta,20000) 377 | title("Open Loop Root Locus - Nominal System"); 378 | print('./img/Cell_1_2_A/open_rlocus_nom','-dsvg'); 379 | 380 | % Step response of the uncertain system 381 | figure 382 | step(T_open) 383 | title("Open Loop Step Response - Nominal System"); 384 | print('./img/Cell_1_2_A/open_step_unc','-dsvg'); 385 | 386 | % Step response of the nominal system 387 | figure 388 | step(ss(T_open)) 389 | title("Open Loop Step Response - Nominal System"); 390 | print('./img/Cell_1_2_A/open_step_nom','-dsvg'); 391 | 392 | % Inner Loop System 393 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 394 | 395 | % Inner Loop Response Analysis: Computing gains for damping = 0.7 of SISO uncertain model q_c --> a_z 396 | 397 | %Root Locus - uncertain 398 | figure 399 | rlocus(T_inner(1)) 400 | zeta=0.707 401 | sgrid(zeta,20000) 402 | title("Inner Loop Root Locus - Uncertain System"); 403 | print('./img/Cell_1_2_A/inner_rlocus_unc','-dsvg'); 404 | 405 | %Root Locus - nominal 406 | figure 407 | rlocus(ss(T_inner(1))) 408 | zeta=0.707 409 | sgrid(zeta,20000) 410 | title("Inner Loop Root Locus - Nominal System"); 411 | print('./img/Cell_1_2_A/inner_rlocus_nom','-dsvg'); 412 | 413 | %step response of the uncertain system 414 | figure 415 | step(T_inner) 416 | title("Inner Loop Step Response - Nominal System"); 417 | print('./img/Cell_1_2_A/inner_step_unc','-dsvg'); 418 | 419 | %step response of the nominal system 420 | figure 421 | step(ss(T_inner)) 422 | title("Inner Loop Step Response - Nominal System"); 423 | print('./img/Cell_1_2_A/inner_step_nom','-dsvg'); 424 | 425 | %%%======================================================================== 426 | % Step : Outter Loop Gain 427 | 428 | % %Definition of Gain for outter Loop 429 | K_s_c = tunableGain('K_s_c',1,1); 430 | steady_state_gain = 1/dcgain(T_inner); 431 | K_s_c.Gain.Value = steady_state_gain(1); 432 | K_s_c.InputName = 'q_s_c'; 433 | K_s_c.OutputName = 'q_c'; 434 | 435 | 436 | % define K_sc for unitary steady state gain 437 | K_sc_sim=tf(1/(-7.9849)); %gain found via bodeplot 438 | K_sc_sim.Inputname = 'q_s_c'; 439 | K_sc_sim.OutputName = 'q_c'; 440 | 441 | 442 | % Combining the Models 443 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 444 | 445 | %transfer function of outter closed loop 446 | G_in=tf(T_outter(1)); 447 | 448 | % Outter Loop Response Analysis 449 | %step response of the uncertain system 450 | figure 451 | step(T_outter) 452 | title("Outter Loop Step Response - Uncertain System"); 453 | print('./img/Cell_1_2_A/outter_step_unc','-dsvg'); 454 | 455 | %step response of the nominal system 456 | figure 457 | step(ss(T_outter)) 458 | title("Outter Loop Step Response - Nominal System"); 459 | print('./img/Cell_1_2_A/outter_step_nom','-dsvg'); 460 | 461 | 462 | %% ================================================================================================== 463 | % Cell for Question 1.2 b): Uncertainty weight computation 464 | %% ================================================================================================== 465 | 466 | % Step : Inner Loop Gain 467 | % Defining Variables 468 | Z_alpha=-1231.914; 469 | M_q=0; 470 | Z_delta=-107.676; 471 | A_alpha=-1429.131; 472 | A_delta=-114.59; 473 | V=947.684; 474 | g=9.81; 475 | omega_a=150; 476 | zeta_a=0.7; 477 | r_M_alpha=57.813; 478 | r_M_delta=32.716; 479 | 480 | % Uncertain parameters 481 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 482 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 483 | 484 | % Defining the Actuator System Matrices of Actuators 485 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 486 | B_ac= [ (0); (omega_a^2)]; 487 | C_ac= [ (1); 0]'; 488 | D_ac= 0; 489 | 490 | % Creating State Space System Model 491 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 492 | 493 | % Defining the Airframe System Matrices 494 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 495 | B_af= [ (Z_delta/V); (M_delta)]; 496 | C_af= [ (A_alpha/g) 0 ; 497 | 0 1 ]'; 498 | D_af= [A_delta/g 0]'; 499 | 500 | % Creating State Space System Model of Airframe 501 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 502 | 503 | 504 | % Defining the Sesnsor System Matrices 505 | A_se= [0 0; 0 0]; 506 | B_se= [0 0; 0 0]; 507 | C_se= [0 0;0 0]; 508 | D_se= [1 0; 0 1]; 509 | 510 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 511 | 512 | % Definition of inner loop Gain Kq 513 | K_q = tunableGain('K_q',1,1); 514 | K_q.Gain.Value = -0.165; %0.00782 515 | K_q.InputName = 'e_q'; 516 | K_q.OutputName = '\delta_q_c'; 517 | 518 | %Summing junction 519 | Sum = sumblk('e_q = q_c - q_m'); 520 | 521 | % Definition of Gain for outter Loop 522 | K_s_c = tunableGain('K_s_c',1,1); 523 | steady_state_gain = 1/dcgain(T_inner); 524 | K_s_c.Gain.Value = steady_state_gain(1); 525 | K_s_c.Gain.Value = 2.3761; 526 | K_s_c.InputName = 'q_s_c'; 527 | K_s_c.OutputName = 'q_c'; 528 | 529 | % Connceting the Models 530 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 531 | 532 | % Decomposing Uncertain ObjectsDecomposing Uncertain Objects 533 | [M,Delta] = lftdata(T_outter) 534 | 535 | % Samples of uncertain state space system 536 | parray = usample(T_outter,50); 537 | parray_a_z = usample(T_outter(1),50); 538 | 539 | nom_sys=ss(T_outter); 540 | 541 | % Creating and Saving Plots 542 | % saving directory 543 | mkdir('./img/Cell_1_2_B'); 544 | 545 | % Nominal Bode 546 | figure 547 | bode(parray,'b--',nom_sys,'r',{.1,1e3}), grid 548 | legend('Frequency response data','Nominal model','Location','NorthEast'); 549 | print('./img/Cell_1_2_B/bode_Nom_Unc','-dsvg'); 550 | 551 | % Fits an uncertain model to a family of LTI models with unstructured uncertainty 552 | [P1,InfoS1] = ucover(parray_a_z,nom_sys(1),1,'InputMult'); 553 | [P2,InfoS2] = ucover(parray_a_z,nom_sys(1),2,'InputMult'); 554 | [P3,InfoS3] = ucover(parray_a_z,nom_sys(1),3,'InputMult'); 555 | [P4,InfoS4] = ucover(parray_a_z,nom_sys(1),4,'InputMult'); 556 | 557 | % Bode plot weigthed trans function: order 558 | Gp=ss(parray_a_z); 559 | G=nom_sys(1); 560 | relerr = (Gp-G)/G; 561 | %Bode Magnjitude 562 | figure 563 | bodemag(relerr,'b',InfoS1.W1,'r-.',InfoS2.W1,'k-.',InfoS3.W1,'m-.',InfoS4.W1,'g-.',{0.1,1000}); 564 | legend('(G_p-G)/G)','Lm(\omega)First-order w','Lm(\omega)Second-order w','Lm(\omega)Third-order w','Lm(\omega)Fourth-order w','Location','SouthWest'); 565 | title("Singular Values - Multiplicative Form (Order Comparison)") 566 | print('./img/Cell_1_2_B/bode_mag_weights_order','-dsvg'); 567 | 568 | % Bode plot weigthed trans function: samples 569 | 570 | % Samples of uncertain state space system 571 | parray_a_z1 = usample(T_outter(1),10); 572 | parray_a_z2 = usample(T_outter(1),20); 573 | parray_a_z3 = usample(T_outter(1),30); 574 | parray_a_z4 = usample(T_outter(1),40); 575 | 576 | nom_sys=ss(T_outter); 577 | 578 | % Creating and Saving Plots 579 | % saving directory 580 | mkdir('./img/Cell_1_2_B'); 581 | 582 | % Nominal Bode 583 | figure 584 | bode(parray,'b--',nom_sys,'r',{.1,1e3}), grid 585 | legend('Frequency response data','Nominal model','Location','NorthEast'); 586 | print('./img/Cell_1_2_B/bode_Nom_Unc','-dsvg'); 587 | 588 | % Fits an uncertain model to a family of LTI models with unstructured uncertainty 589 | [P1,InfoS1] = ucover(parray_a_z1,nom_sys(1),2,'InputMult'); 590 | [P2,InfoS2] = ucover(parray_a_z2,nom_sys(1),2,'InputMult'); 591 | [P3,InfoS3] = ucover(parray_a_z3,nom_sys(1),2,'InputMult'); 592 | [P4,InfoS4] = ucover(parray_a_z4,nom_sys(1),2,'InputMult'); 593 | 594 | % Bode plot weigthed trans function: order 595 | Gp=ss(parray_a_z); 596 | G=nom_sys(1); 597 | relerr = (Gp-G)/G; 598 | %Bode Magnjitude 599 | figure 600 | bodemag(relerr,'b',InfoS1.W1,'r-.',InfoS2.W1,'k-.',InfoS3.W1,'m-.',InfoS4.W1,'g-.',{0.1,1000}); 601 | legend('(G_p-G)/G)','Lm(\omega)- 10 Samples','Lm(\omega) - 20 Samples','Lm(\omega) - 30 Samples','Lm(\omega)- 40 Samples','Location','SouthWest'); 602 | title("Singular Values - Multiplicative Form (Sample Comparison)") 603 | print('./img/Cell_1_2_B/bode_mag_weights_sampels_multi','-dsvg'); 604 | 605 | %%+=============================== 606 | %%Additive 607 | %%+=============================== 608 | 609 | % Fits an uncertain model to a family of LTI models with unstructured uncertainty 610 | [P1,InfoS1A] = ucover(parray_a_z,nom_sys(1),1,'Additive'); 611 | [P2,InfoS2A] = ucover(parray_a_z,nom_sys(1),2,'Additive'); 612 | [P3,InfoS3A] = ucover(parray_a_z,nom_sys(1),3,'Additive'); 613 | [P4,InfoS4A] = ucover(parray_a_z,nom_sys(1),4,'Additive'); 614 | 615 | % Bode plot weigthed trans function: order 616 | Gp=ss(parray_a_z); 617 | G=nom_sys(1); 618 | relerr = (Gp-G)/G; 619 | 620 | %Bode Magnjitude 621 | figure 622 | bodemag(relerr,'b',InfoS1A.W1,'r-.',InfoS2A.W1,'k-.',InfoS3A.W1,'m-.',InfoS4A.W1,'g-.',{0.1,1000}); 623 | legend('(G_p-G)/G)','Lm(\omega)First-order w','Lm(\omega)Second-order w','Lm(\omega)Third-order w','Lm(\omega)Fourth-order w','Location','SouthWest'); 624 | title("Singular Values - Multiplication Form (Order Comparison)") 625 | print('./img/Cell_1_2_B/bode_mag_weights_order_addi','-dsvg'); 626 | 627 | 628 | figure 629 | bode(InfoS1.W1); 630 | title('Scalar Additive Uncertainty Model') 631 | legend('First-order w','Min. uncertainty amount','Location','SouthWest'); 632 | print('./img/Cell_1_2_B/bode_weight1_addi_order','-dsvg'); 633 | 634 | % Fits an uncertain model to a family of LTI models with unstructured uncertainty 635 | [P1,InfoS1A] = ucover(parray_a_z1,nom_sys(1),2,'Additive'); 636 | [P2,InfoS2A] = ucover(parray_a_z2,nom_sys(1),2,'Additive'); 637 | [P3,InfoS3A] = ucover(parray_a_z3,nom_sys(1),2,'Additive'); 638 | [P4,InfoS4A] = ucover(parray_a_z4,nom_sys(1),2,'Additive'); 639 | 640 | % Bode plot weigthed trans function: order 641 | Gp=ss(parray_a_z); 642 | G=nom_sys(1); 643 | relerr = (Gp-G)/G; 644 | %Bode Magnjitude 645 | figure 646 | bodemag(relerr,'b',InfoS1A.W1,'r-.',InfoS2A.W1,'k-.',InfoS3A.W1,'m-.',InfoS4A.W1,'g-.',{0.1,1000}); 647 | legend('(G_p-G)/G)','Lm(\omega)- 10 Samples','Lm(\omega) - 20 Samples','Lm(\omega) - 30 Samples','Lm(\omega)- 40 Samples','Location','SouthWest'); 648 | print('./img/Cell_1_2_B/bode_mag_weights_sampels_addi','-dsvg'); 649 | title("Singular Values - Additive Form ((Sample Comparison)"); 650 | print('./img/Cell_1_2_B/bode_weight1_addi_samples','-dsvg'); 651 | 652 | %%+=============================== 653 | figure 654 | bode(InfoS1.W1); 655 | title('Scalar Additive Uncertainty Model') 656 | legend('First-order w','Min. uncertainty amount','Location','SouthWest'); 657 | print('./img/Cell_1_2_B/bode_weight1_addi','-dsvg'); 658 | 659 | 660 | %% ================================================================================================== 661 | % Cell for Question 2.1 a): Verify inner loop system 662 | %% ================================================================================================== 663 | 664 | % Step : Inner Loop Gain 665 | 666 | % Defining Variables 667 | Z_alpha=-1231.914; 668 | M_q=0; 669 | Z_delta=-107.676; 670 | A_alpha=-1429.131; 671 | A_delta=-114.59; 672 | V=947.684; 673 | g=9.81; 674 | omega_a=150; 675 | zeta_a=0.7; 676 | r_M_alpha=57.813; 677 | r_M_delta=32.716; 678 | 679 | % Uncertain parameters 680 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 681 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 682 | 683 | % Defining the Actuator System Matrices of Actuators 684 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 685 | B_ac= [ (0); (omega_a^2)]; 686 | C_ac= [ (1); 0]'; 687 | D_ac= 0; 688 | 689 | % Creating State Space System Model 690 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 691 | 692 | % Defining the Airframe System Matrices 693 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 694 | B_af= [ (Z_delta/V); (M_delta)]; 695 | C_af= [ (A_alpha/g) 0 ; 696 | 0 1 ]'; 697 | D_af= [A_delta/g 0]'; 698 | 699 | % Creating State Space System Model of Airframe 700 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 701 | 702 | 703 | % Defining the Sesnsor System Matrices 704 | A_se= [0 0; 0 0]; 705 | B_se= [0 0; 0 0]; 706 | C_se= [0 0;0 0]; 707 | D_se= [1 0; 0 1]; 708 | 709 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 710 | 711 | % Definition of inner loop Gain Kq 712 | K_q = tunableGain('K_q',1,1); 713 | K_q.Gain.Value = -1*0.141; %-0.165; %0.00782 714 | K_q.InputName = 'e_q'; 715 | K_q.OutputName = '\delta_q_c'; 716 | 717 | %Summing junction 718 | Sum = sumblk('e_q = q_c - q_m'); 719 | 720 | % open Loop System 721 | T_open = connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'}); 722 | 723 | % Inner Loop System 724 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 725 | 726 | % Definition of Gain for outter Loop 727 | K_s_c = tunableGain('K_s_c',1,1); 728 | steady_state_gain = 1/dcgain(T_inner); 729 | K_s_c.Gain.Value = steady_state_gain(1); 730 | K_s_c.Gain.Value = 2.3761; 731 | K_s_c.InputName = 'q_s_c'; 732 | K_s_c.OutputName = 'q_c'; 733 | 734 | 735 | % Inner Loop Analysis: Computing gains for damping = 0.7 of SISO uncertain model q_c --> a_z 736 | 737 | % Saving Plotsin directory 738 | mkdir('./img/Cell_2_1_A'); 739 | 740 | %getting Transferfunction of inner loop 741 | inner_tf=tf(T_inner) 742 | 743 | %ploting the poles and zeros Uncertain 744 | figure 745 | iopzplot(T_inner); 746 | title("Z-Plane Diagram - Inner Closed Loop System (Uncertain)"); 747 | print('./img/Cell_2_1_A/ZPlane_unc','-dsvg'); 748 | 749 | %ploting the poles and zeros Nominal 750 | figure 751 | iopzplot(ss(T_inner)); 752 | title("Z-Plane Diagram - Inner Closed Loop System (Nominal)"); 753 | print('./img/Cell_2_1_A/ZPlane_nom','-dsvg'); 754 | 755 | %step response of the uncertain system 756 | figure 757 | step(T_inner) 758 | title("IStep Response - Inner Closed Loop System (Uncertain)"); 759 | print('./img/Cell_2_1_A/inner_step_unc','-dsvg'); 760 | 761 | % Information of Step Respomse: settling time and overshoot 762 | inner_step=stepinfo(T_inner); 763 | 764 | % Time it takes for the errors between the response y(t) and the steady-state response yfinal to fall to within 2% of yfinal. 765 | settlingTime=inner_step.SettlingTime 766 | % Percentage overshoot, relative to yfinal). 767 | overShot=inner_step.Overshoot 768 | 769 | %step response of the nominal system 770 | figure 771 | step(ss(T_inner)) 772 | title("Step Response - Inner Closed Loop System (Nominal)"); 773 | print('./img/Cell_1_2_A/inner_step_nom','-dsvg'); 774 | 775 | % Connceting the Models 776 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 777 | 778 | 779 | %% ================================================================================================== 780 | %Cell for Question 2.1 b): Reference model computation 781 | %% ================================================================================================== 782 | 783 | % Step : Inner Loop Gain 784 | % Defining Variables 785 | Z_alpha=-1231.914; 786 | M_q=0; 787 | Z_delta=-107.676; 788 | A_alpha=-1429.131; 789 | A_delta=-114.59; 790 | V=947.684; 791 | g=9.81; 792 | omega_a=150; 793 | zeta_a=0.7; 794 | r_M_alpha=57.813; 795 | r_M_delta=32.716; 796 | 797 | % Uncertain parameters 798 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 799 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 800 | 801 | % Defining the Actuator System Matrices of Actuators 802 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 803 | B_ac= [ (0); (omega_a^2)]; 804 | C_ac= [ (1); 0]'; 805 | D_ac= 0; 806 | 807 | % Creating State Space System Model 808 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 809 | 810 | % Defining the Airframe System Matrices 811 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 812 | B_af= [ (Z_delta/V); (M_delta)]; 813 | C_af= [ (A_alpha/g) 0 ; 814 | 0 1 ]'; 815 | D_af= [A_delta/g 0]'; 816 | 817 | % Creating State Space System Model of Airframe 818 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 819 | 820 | 821 | % Defining the Sesnsor System Matrices 822 | A_se= [0 0; 0 0]; 823 | B_se= [0 0; 0 0]; 824 | C_se= [0 0;0 0]; 825 | D_se= [1 0; 0 1]; 826 | 827 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 828 | 829 | % Definition of inner loop Gain Kq 830 | K_q = tunableGain('K_q',1,1); 831 | K_q.Gain.Value = -0.165; %0.00782 832 | K_q.InputName = 'e_q'; 833 | K_q.OutputName = '\delta_q_c'; 834 | 835 | %Summing junction 836 | Sum = sumblk('e_q = q_c - q_m'); 837 | 838 | % Reference model computation: 839 | % Transfer Function Computing 840 | % tunning requirement of max. 2% overshoot 841 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009 842 | 843 | % tuning requirements of 0.2 seconcs 844 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6 845 | 846 | % non minimum phase zero of system (closed loop system) 847 | z_n_m_p=36.6; 848 | 849 | % definition of transfer function 850 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]); 851 | 852 | % printing relevant step information 853 | step_information = stepinfo(T_r_m) 854 | 855 | 856 | %% ================================================================================================== 857 | % Cell for Question 2.1 c): Weighting filter selection 858 | %% ================================================================================================== 859 | 860 | 861 | % Step : Inner Loop Gain 862 | % Defining Variables 863 | Z_alpha=-1231.914; 864 | M_q=0; 865 | Z_delta=-107.676; 866 | A_alpha=-1429.131; 867 | A_delta=-114.59; 868 | V=947.684; 869 | g=9.81; 870 | omega_a=150; 871 | zeta_a=0.7; 872 | r_M_alpha=57.813; 873 | r_M_delta=32.716; 874 | 875 | % Uncertain parameters 876 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 877 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 878 | 879 | % Defining the Actuator System Matrices of Actuators 880 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 881 | B_ac= [ (0); (omega_a^2)]; 882 | C_ac= [ (1); 0]'; 883 | D_ac= 0; 884 | 885 | % Creating State Space System Model 886 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 887 | 888 | % Defining the Airframe System Matrices 889 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 890 | B_af= [ (Z_delta/V); (M_delta)]; 891 | C_af= [ (A_alpha/g) 0 ; 892 | 0 1 ]'; 893 | D_af= [A_delta/g 0]'; 894 | 895 | % Creating State Space System Model of Airframe 896 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 897 | 898 | 899 | % Defining the Sesnsor System Matrices 900 | A_se= [0 0; 0 0]; 901 | B_se= [0 0; 0 0]; 902 | C_se= [0 0;0 0]; 903 | D_se= [1 0; 0 1]; 904 | 905 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 906 | 907 | % Definition of inner loop Gain Kq 908 | K_q = tunableGain('K_q',1,1); 909 | K_q.Gain.Value = -0.165; %0.00782 910 | K_q.InputName = 'e_q'; 911 | K_q.OutputName = '\delta_q_c'; 912 | 913 | %Summing junction 914 | Sum = sumblk('e_q = q_c - q_m'); 915 | 916 | % Inner Loop System 917 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 918 | 919 | % Reference model computation: 920 | 921 | % computing the non minimum phase zero of 922 | inner_zeros=zero(T_inner(1)); 923 | z_n_m_p=inner_zeros(1); 924 | 925 | % Parameter Computing 926 | % tunning requirement of max. 2% overshoot 927 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009 928 | 929 | % tuning requirements of 0.2 seconcs 930 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6 931 | 932 | % definition of transfer function 933 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]); 934 | 935 | %Step: Weighting filter selection 936 | 937 | % Sensitivity function Analysis 938 | s_t=1-T_r_m; 939 | % get gain respones of system 940 | [mag_s,phase,wout] = bode(s_t); 941 | 942 | % compute further needed parameter 943 | omega_i_s=6.81; %from bode plot at gain -3 db 944 | k_i_s=0.707; 945 | 946 | % high and low frequency gain 947 | lfgain_s = mag_s(1); 948 | hfgain_s = mag_s(end); 949 | % needed pole 950 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s; 951 | 952 | % Complementary sensitivity function Analysis 953 | w_t=tf(T_r_m); 954 | % w_t=tf(Gss_ac); 955 | 956 | % get gain respones of system 957 | [mag_t,phase,wout] = bode(T_r_m); 958 | % [Gm,Pm,Wcg,Wcp] = margin(w_t); 959 | % compute further needed parameter 960 | omega_i_t=20.8; %from bode plot at gain -3 db 961 | k_i_t=0.707; 962 | 963 | % high and low frequency gain 964 | lfgain_t = mag_t(1); 965 | hfgain_t = mag_t(end); 966 | 967 | % needed pole 968 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t; 969 | 970 | % weight definition 971 | s = zpk('s'); 972 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s)); 973 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t)); 974 | W3 = []; 975 | 976 | %sensitivty function values 977 | S_o=(1/W1); 978 | KS_o=(1/W2); 979 | 980 | % mixsyn shapes the singular values of the sensitivity function S 981 | % [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3); 982 | 983 | % Saving Plotsin directory 984 | mkdir('./img/Cell_2_1_C'); 985 | 986 | %plot of singular system diagram 987 | figure 988 | sigma(s_t,'r-',T_r_m,'c-',S_o,'k-',KS_o,'g-') 989 | legend('S_t','T_{RM}','S_o','KS_o','Location','Northwest') 990 | title("Singular Values - Weight Filter"); 991 | print('./img/Cell_2_1_C/sigma_weights','-dsvg'); 992 | 993 | % ilustrate target transfer function 994 | % plot S_o 995 | figure 996 | bodemag(S_o,'r'); 997 | title("Singular Values - S_0"); 998 | print('./img/Cell_2_1_C/sigma_weights_s_0','-dsvg'); 999 | 1000 | 1001 | %plot KS_o 1002 | figure 1003 | bodemag(KS_o,'r') 1004 | title("Singular Values - KS_0"); 1005 | print('./img/Cell_2_1_C/sigma_weights_ks_0','-dsvg'); 1006 | 1007 | %% ================================================================================================== 1008 | % Cell for Question 2.1 d): Synthesis block diagram 1009 | %% ================================================================================================== 1010 | % Defining Variables 1011 | Z_alpha=-1231.914; 1012 | M_q=0; 1013 | Z_delta=-107.676; 1014 | A_alpha=-1429.131; 1015 | A_delta=-114.59; 1016 | V=947.684; 1017 | g=9.81; 1018 | omega_a=150; 1019 | zeta_a=0.7; 1020 | r_M_alpha=57.813; 1021 | r_M_delta=32.716; 1022 | 1023 | % Uncertain parameters 1024 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 1025 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 1026 | 1027 | % Defining the Actuator System Matrices of Actuators 1028 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 1029 | B_ac= [ (0); (omega_a^2)]; 1030 | C_ac= [ (1); 0]'; 1031 | D_ac= 0; 1032 | 1033 | % Creating State Space System Model 1034 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 1035 | 1036 | % Defining the Airframe System Matrices 1037 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 1038 | B_af= [ (Z_delta/V); (M_delta)]; 1039 | C_af= [ (A_alpha/g) 0 ; 1040 | 0 1 ]'; 1041 | D_af= [A_delta/g 0]'; 1042 | 1043 | % Creating State Space System Model of Airframe 1044 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 1045 | 1046 | 1047 | % Defining the Sesnsor System Matrices 1048 | A_se= [0 0; 0 0]; 1049 | B_se= [0 0; 0 0]; 1050 | C_se= [0 0;0 0]; 1051 | D_se= [1 0; 0 1]; 1052 | 1053 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 1054 | 1055 | % Definition of inner loop Gain Kq 1056 | K_q = tunableGain('K_q',1,1); 1057 | K_q.Gain.Value = -0.165; %0.00782 1058 | K_q.InputName = 'e_q'; 1059 | K_q.OutputName = '\delta_q_c'; 1060 | 1061 | %Summing junction 1062 | Sum = sumblk('e_q = q_c - q_m'); 1063 | 1064 | % Inner Loop System 1065 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 1066 | 1067 | % Step : Outter Loop Gain 1068 | 1069 | % %Definition of Gain for outter Loop 1070 | K_s_c = tunableGain('K_s_c',1,1); 1071 | steady_state_gain = 1/dcgain(T_inner); 1072 | K_s_c.Gain.Value = steady_state_gain(1); 1073 | K_s_c.InputName = 'q_s_c'; 1074 | K_s_c.OutputName = 'q_c'; 1075 | 1076 | % Combining the Models 1077 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 1078 | 1079 | % Reference model computation: 1080 | 1081 | % computing the non minimum phase zero of 1082 | inner_zeros=zero(T_inner(1)); 1083 | z_n_m_p=inner_zeros(1); 1084 | 1085 | % Parameter Computing 1086 | % tunning requirement of max. 2% overshoot 1087 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009 1088 | 1089 | % tuning requirements of 0.2 seconcs 1090 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6 1091 | 1092 | % definition of transfer function 1093 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]); 1094 | T_r_m.InputName = {'a_z_c'}; 1095 | T_r_m.OutputName = {'a_z_t'}; 1096 | 1097 | % Weighting filter selection 1098 | 1099 | % Sensitivity function Analysis 1100 | s_t=1-T_r_m; 1101 | w_s=1/s_t; 1102 | 1103 | % get gain respones of system 1104 | [mag_s,phase,wout] = bode(s_t); 1105 | % [Gm,Pm,Wcg,Wcp] = margin(w_s); 1106 | 1107 | % compute further needed parameter 1108 | omega_i_s=6.81; %from bode plot at gain -3 db 1109 | k_i_s=0.707; 1110 | 1111 | % high and low frequency gain 1112 | lfgain_s = mag_s(1); 1113 | hfgain_s = mag_s(end); 1114 | 1115 | % needed pole 1116 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s; 1117 | 1118 | % Complementary sensitivity function Analysis 1119 | w_t=tf(T_r_m); 1120 | % w_t=tf(Gss_ac); 1121 | 1122 | % get gain respones of system 1123 | [mag_t,phase,wout] = bode(T_r_m); 1124 | % [Gm,Pm,Wcg,Wcp] = margin(w_t); 1125 | 1126 | % compute further needed parameter 1127 | omega_i_t=20.8; %from bode plot at gain -3 db 1128 | k_i_t=0.707; 1129 | 1130 | % high and low frequency gain 1131 | lfgain_t = mag_t(1); 1132 | hfgain_t = mag_t(end); 1133 | 1134 | % needed pole 1135 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t; 1136 | 1137 | % weight definition 1138 | s = zpk('s'); 1139 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s)); 1140 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t)); 1141 | W3 = []; 1142 | 1143 | % mixsyn shapes the singular values of the sensitivity function S 1144 | [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3); 1145 | 1146 | % Synthesis block diagram 1147 | 1148 | %Summing junctions 1149 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d'); 1150 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d'); 1151 | 1152 | %change of input names 1153 | sum_r = sumblk('r = a_z_c'); 1154 | sum_r.OutputName = {'a_z_c'}; 1155 | sum_r.InputName = {'r'}; 1156 | 1157 | sum_d = sumblk('d = a_z_d'); 1158 | sum_d.OutputName = {'a_z_d'}; 1159 | sum_d.InputName = {'d'}; 1160 | 1161 | sum_u = sumblk('u = q_s_c'); 1162 | sum_u.OutputName = {'q_s_c'}; 1163 | sum_u.InputName = {'u'}; 1164 | 1165 | %Gain Matrices 1166 | K_z = tunableGain('K_z',2,2); 1167 | K_z.Gain.Value = eye(2); 1168 | K_z.InputName = {'a_z_tmd','q_s_c'}; 1169 | K_z.OutputName = {'z_1_tild','z_2_tild'}; 1170 | 1171 | K_v = tunableGain('K_v',2,2); 1172 | K_v.Gain.Value = eye(2); 1173 | K_v.InputName = {'a_z_m_d','a_z_c'}; 1174 | K_v.OutputName = {'v_1','v_2'}; 1175 | 1176 | 1177 | % Compute orange box transfer function 1178 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'}); 1179 | 1180 | % Transferfunction 1181 | Tf_p_s = tf(P_s_tild); 1182 | 1183 | % Compute orange + Green box transfer function 1184 | 1185 | %Weight Matrices 1186 | % Component 1 1187 | Tf_ws_1 = tf(W1); 1188 | Tf_ws_1.InputName='z_1_tild'; 1189 | Tf_ws_1.OutputName='z_1'; 1190 | % Component 2 1191 | Tf_ws_2 = tf(W2); 1192 | Tf_ws_2.InputName='z_2_tild'; 1193 | Tf_ws_2.OutputName='z_2'; 1194 | 1195 | % Connceted system 1196 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'}); 1197 | 1198 | % Give out final Transfer function 1199 | tf_tild=tf(P_s_tild); 1200 | tf_full=tf(P_s); 1201 | 1202 | 1203 | %% ================================================================================================== 1204 | % Cell for Question 2.1 e): Controller Synthesis 1205 | %% ================================================================================================== 1206 | 1207 | % Step : Inner Loop Gain 1208 | % Defining Variables 1209 | Z_alpha=-1231.914; 1210 | M_q=0; 1211 | Z_delta=-107.676; 1212 | A_alpha=-1429.131; 1213 | A_delta=-114.59; 1214 | V=947.684; 1215 | g=9.81; 1216 | omega_a=150; 1217 | zeta_a=0.7; 1218 | r_M_alpha=57.813; 1219 | r_M_delta=32.716; 1220 | 1221 | % Uncertain parameters 1222 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 1223 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 1224 | 1225 | % Defining the Actuator System Matrices of Actuators 1226 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 1227 | B_ac= [ (0); (omega_a^2)]; 1228 | C_ac= [ (1); 0]'; 1229 | D_ac= 0; 1230 | 1231 | % Creating State Space System Model 1232 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 1233 | 1234 | % Defining the Airframe System Matrices 1235 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 1236 | B_af= [ (Z_delta/V); (M_delta)]; 1237 | C_af= [ (A_alpha/g) 0 ; 1238 | 0 1 ]'; 1239 | D_af= [A_delta/g 0]'; 1240 | 1241 | % Creating State Space System Model of Airframe 1242 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 1243 | 1244 | 1245 | % Defining the Sesnsor System Matrices 1246 | A_se= [0 0; 0 0]; 1247 | B_se= [0 0; 0 0]; 1248 | C_se= [0 0;0 0]; 1249 | D_se= [1 0; 0 1]; 1250 | 1251 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 1252 | 1253 | % Definition of inner loop Gain Kq 1254 | K_q = tunableGain('K_q',1,1); 1255 | K_q.Gain.Value = -0.165; %0.00782 1256 | K_q.InputName = 'e_q'; 1257 | K_q.OutputName = '\delta_q_c'; 1258 | 1259 | % paraemter for simulink modul 1260 | K_q_value=-0.165; 1261 | 1262 | %Summing junction 1263 | Sum = sumblk('e_q = q_c - q_m'); 1264 | 1265 | % Inner Loop System 1266 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 1267 | 1268 | % Step : Outter Loop Gain 1269 | 1270 | % %Definition of Gain for outter Loop 1271 | K_s_c = tunableGain('K_s_c',1,1); 1272 | steady_state_gain = 1/dcgain(T_inner); 1273 | K_s_c.Gain.Value = steady_state_gain(1); 1274 | K_s_c.InputName = 'q_s_c'; 1275 | K_s_c.OutputName = 'q_c'; 1276 | 1277 | % Combining the Models 1278 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 1279 | 1280 | % Reference model computation: 1281 | 1282 | % computing the non minimum phase zero of 1283 | inner_zeros=zero(T_inner(1)); 1284 | z_n_m_p=inner_zeros(1); 1285 | 1286 | % Parameter Computing 1287 | % tunning requirement of max. 2% overshoot 1288 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009 1289 | 1290 | % tuning requirements of 0.2 seconcs 1291 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6 1292 | 1293 | % definition of transfer function 1294 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]); 1295 | T_r_m.InputName = {'a_z_c'}; 1296 | T_r_m.OutputName = {'a_z_t'}; 1297 | 1298 | %Weighting Filter Selection 1299 | 1300 | % Sensitivity function Analysis 1301 | s_t=1-T_r_m; 1302 | w_s=1/s_t; 1303 | 1304 | % get gain respones of system 1305 | [mag_s,phase,wout] = bode(s_t); 1306 | % [Gm,Pm,Wcg,Wcp] = margin(w_s); 1307 | 1308 | % compute further needed parameter 1309 | omega_i_s=6.81; %from bode plot at gain -3 db 1310 | k_i_s=0.707; 1311 | 1312 | % high and low frequency gain 1313 | lfgain_s = mag_s(1); 1314 | hfgain_s = mag_s(end); 1315 | 1316 | % needed pole 1317 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s; 1318 | 1319 | % Complementary sensitivity function Analysis 1320 | % w_t=tf(T_r_m); 1321 | w_t=tf(Gss_ac); 1322 | 1323 | % get gain respones of system 1324 | [mag_t,phase,wout] = bode(T_r_m); 1325 | % [Gm,Pm,Wcg,Wcp] = margin(w_t); 1326 | 1327 | % compute further needed parameter 1328 | omega_i_t=20.8; %from bode plot at gain -3 db 1329 | k_i_t=0.707; 1330 | 1331 | % high and low frequency gain 1332 | lfgain_t = mag_t(1); 1333 | hfgain_t = mag_t(end); 1334 | 1335 | % needed pole 1336 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t; 1337 | 1338 | % Weight definition 1339 | s = zpk('s'); 1340 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s)); 1341 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t)); 1342 | W3 = []; 1343 | 1344 | %sensitivty function values 1345 | S_o=(1/W1); 1346 | KS_o=(1/W2); 1347 | 1348 | % mixsyn shapes the singular values of the sensitivity function S 1349 | % [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3); 1350 | 1351 | % Synthesis block diagram 1352 | 1353 | %Summing junctions 1354 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d'); 1355 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d'); 1356 | 1357 | %change of input names 1358 | sum_r = sumblk('r = a_z_c'); 1359 | sum_r.OutputName = {'a_z_c'}; 1360 | sum_r.InputName = {'r'}; 1361 | 1362 | sum_d = sumblk('d = a_z_d'); 1363 | sum_d.OutputName = {'a_z_d'}; 1364 | sum_d.InputName = {'d'}; 1365 | 1366 | sum_u = sumblk('u = q_s_c'); 1367 | sum_u.OutputName = {'q_s_c'}; 1368 | sum_u.InputName = {'u'}; 1369 | 1370 | %Gain Matrices 1371 | K_z = tunableGain('K_z',2,2); 1372 | K_z.Gain.Value = eye(2); 1373 | K_z.InputName = {'a_z_tmd','a_z_d'}; 1374 | K_z.OutputName = {'z_1_tild','z_2_tild'}; 1375 | 1376 | K_v = tunableGain('K_v',2,2); 1377 | K_v.Gain.Value = eye(2); 1378 | K_v.InputName = {'a_z_m_d','a_z_c'}; 1379 | K_v.OutputName = {'v_1','v_2'}; 1380 | 1381 | 1382 | % Compute orange box transfer function 1383 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'}); 1384 | 1385 | % Compute orange + Green box transfer function 1386 | 1387 | %Weight Matrices 1388 | % Component 1 1389 | Tf_ws_1 = tf(W1); 1390 | Tf_ws_1.InputName='z_1_tild'; 1391 | Tf_ws_1.OutputName='z_1'; 1392 | % Component 2 1393 | Tf_ws_2 = tf(W2); 1394 | Tf_ws_2.InputName='z_2_tild'; 1395 | Tf_ws_2.OutputName='z_2'; 1396 | 1397 | % Connceted system 1398 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'}); 1399 | 1400 | % Create Augmented Plant for H-Infinity Synthesis 1401 | 1402 | 1403 | % P = augw(P_s_tild,W1,W2); 1404 | %total number of controller inputs 1405 | NMEAS=2; 1406 | % total number of controller outputs 1407 | NCON=1; 1408 | 1409 | %hinfstruct 1410 | [K_F0,CL,GAM] = hinfsyn(P_s,NMEAS,NCON); 1411 | 1412 | % % further parameter 1413 | % S = (1-P_s(2,1)*K)^-1; 1414 | % R = K*S; 1415 | % T = 1-S; 1416 | % 1417 | % figure; 1418 | % sigma(S,'m-',K_F0*S,'g-'); 1419 | % legend('S_0','K*S_0','Location','Northwest'); 1420 | 1421 | % Plots 1422 | 1423 | % saving directory 1424 | mkdir('./img/Cell_2_1_E'); 1425 | 1426 | figure; 1427 | bode(K_F0(2),'m-',CL,'g-'); 1428 | title("Bode Diagram of K_{F0}"); 1429 | print('./img/Cell_2_1_E/bode_kf0','-dsvg'); 1430 | 1431 | % obtaining the decomposed control system gains 1432 | K_dr=K_F0(1); 1433 | K_cf=K_F0(2); 1434 | 1435 | % minimal control orders 1436 | ordDr=tf(minreal(K_dr)); 1437 | ordCf=tf(minreal(K_cf)); 1438 | 1439 | % Weighted closed loop transfer matrix components 1440 | T_r_z1 = tf(P_s(1,1)); 1441 | T_d_z1 = tf(P_s(1,2)); 1442 | T_r_z2 = tf(P_s(2,1)); 1443 | T_d_z2 = tf(P_s(2,2)); 1444 | 1445 | % Unweighted closed loop transfer matrix components 1446 | UT_r_z1 = tf(P_s_tild(1,1)); 1447 | UT_d_z1 = tf(P_s_tild(1,2)); 1448 | UT_r_z2 = tf(P_s_tild(2,1)); 1449 | UT_d_z2 = tf(P_s_tild(2,2)); 1450 | 1451 | % performance level 1452 | perf_level=hinfnorm(CL); 1453 | 1454 | % plot T_wTOztilda and superimpose it with inverse of weight functions 1455 | figure() 1456 | subplot(2,2,1) 1457 | sigma(UT_r_z1) 1458 | grid on 1459 | hold on 1460 | sigma(UT_r_z1*S_o) 1461 | sigma(UT_r_z1*KS_o) 1462 | hold off 1463 | title('Input: r Output: z_tild_1') 1464 | 1465 | subplot(2,2,2) 1466 | sigma(UT_d_z1) 1467 | grid on 1468 | hold on 1469 | sigma(UT_d_z1*S_o) 1470 | sigma(UT_d_z1*KS_o) 1471 | hold off 1472 | title('Input: d Output: z_tild_1') 1473 | 1474 | subplot(2,2,3) 1475 | sigma(UT_r_z2) 1476 | grid on 1477 | hold on 1478 | sigma(UT_r_z2*S_o) 1479 | sigma(UT_r_z2*KS_o) 1480 | hold off 1481 | title('Input: r Output: z_tild_2') 1482 | 1483 | subplot(2,2,4) 1484 | sigma(UT_d_z2) 1485 | grid on 1486 | hold on 1487 | sigma(UT_d_z2*S_o) 1488 | sigma(UT_d_z2*KS_o) 1489 | hold off 1490 | title('Input: d Output: z_tild_2') 1491 | % save diagram 1492 | print('./img/Cell_2_1_E/sigma_unweight_weight','-dsvg'); 1493 | 1494 | %adaption of different weight filter adaptions 1495 | % figure() 1496 | % for i=1:0.5:10 1497 | % % prior weightaning bandwidth 1498 | % omega_prime1=sqrt((M_h1^2-k1^2)/(k1^2-M_l1^2))*i; 1499 | % W1=tf([1,omega_prime1],[M_h1,omega_prime1*M_l1]); 1500 | % 1501 | % S_o=(1/W1); 1502 | % bode(S_o,'k') 1503 | % hold on 1504 | % % sigma(T_wTOztilda(1,1)*S_o,'k') 1505 | % % hold on 1506 | % % sigma(T_wTOztilda(1,2)*S_o,'k') 1507 | % % hold on 1508 | % end 1509 | % hold off 1510 | 1511 | %% ================================================================================================== 1512 | % %% Cell for Question 2.1 f): Controller Implementation 1513 | %% ================================================================================================== 1514 | 1515 | % Step : Inner Loop Gain 1516 | % Defining Variables 1517 | Z_alpha=-1231.914; 1518 | M_q=0; 1519 | Z_delta=-107.676; 1520 | A_alpha=-1429.131; 1521 | A_delta=-114.59; 1522 | V=947.684; 1523 | g=9.81; 1524 | omega_a=150; 1525 | zeta_a=0.7; 1526 | r_M_alpha=57.813; 1527 | r_M_delta=32.716; 1528 | 1529 | % Uncertain parameters 1530 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]); 1531 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]); 1532 | 1533 | % Defining the Actuator System Matrices of Actuators 1534 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)]; 1535 | B_ac= [ (0); (omega_a^2)]; 1536 | C_ac= [ (1); 0]'; 1537 | D_ac= 0; 1538 | 1539 | % Creating State Space System Model 1540 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'}); 1541 | 1542 | % Defining the Airframe System Matrices 1543 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)]; 1544 | B_af= [ (Z_delta/V); (M_delta)]; 1545 | C_af= [ (A_alpha/g) 0 ; 1546 | 0 1 ]'; 1547 | D_af= [A_delta/g 0]'; 1548 | 1549 | % Creating State Space System Model of Airframe 1550 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'}); 1551 | 1552 | 1553 | % Defining the Sesnsor System Matrices 1554 | A_se= [0 0; 0 0]; 1555 | B_se= [0 0; 0 0]; 1556 | C_se= [0 0;0 0]; 1557 | D_se= [1 0; 0 1]; 1558 | 1559 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'}); 1560 | 1561 | % Definition of inner loop Gain Kq 1562 | K_q = tunableGain('K_q',1,1); 1563 | K_q.Gain.Value = -0.165; %0.00782 1564 | K_q.InputName = 'e_q'; 1565 | K_q.OutputName = '\delta_q_c'; 1566 | 1567 | %Summing junction 1568 | Sum = sumblk('e_q = q_c - q_m'); 1569 | 1570 | % Inner Loop System 1571 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'}); 1572 | 1573 | % Step : Outter Loop Gain 1574 | 1575 | % %Definition of Gain for outter Loop 1576 | K_s_c = tunableGain('K_s_c',1,1); 1577 | steady_state_gain = 1/dcgain(T_inner); 1578 | K_s_c.Gain.Value = steady_state_gain(1); 1579 | K_s_c.InputName = 'q_s_c'; 1580 | K_s_c.OutputName = 'q_c'; 1581 | 1582 | %value parameter for simulink modul 1583 | K_s_c_value=1/dcgain(T_inner); 1584 | 1585 | % Combining the Models 1586 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'}); 1587 | 1588 | % Reference model computation: 1589 | 1590 | % computing the non minimum phase zero of 1591 | inner_zeros=zero(T_inner(1)); 1592 | z_n_m_p=inner_zeros(1); 1593 | 1594 | % Parameter Computing 1595 | % tunning requirement of max. 2% overshoot 1596 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009 1597 | 1598 | % tuning requirements of 0.2 seconcs 1599 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6 1600 | 1601 | % definition of transfer function 1602 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]); 1603 | T_r_m.InputName = {'a_z_c'}; 1604 | T_r_m.OutputName = {'a_z_t'}; 1605 | 1606 | % Weighting Filter Selection 1607 | 1608 | % Sensitivity function Analysis 1609 | s_t=1-T_r_m; 1610 | w_s=1/s_t; 1611 | 1612 | % get gain respones of system 1613 | [mag_s,phase,wout] = bode(s_t); 1614 | % [Gm,Pm,Wcg,Wcp] = margin(w_s); 1615 | 1616 | % compute further needed parameter 1617 | omega_i_s=6.81; %from bode plot at gain -3 db 1618 | k_i_s=0.707; 1619 | 1620 | % high and low frequency gain 1621 | lfgain_s = mag_s(1); 1622 | hfgain_s = mag_s(end); 1623 | 1624 | % needed pole 1625 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s; 1626 | 1627 | % Complementary sensitivity function Analysis 1628 | % w_t=tf(T_r_m); 1629 | w_t=tf(Gss_ac); 1630 | 1631 | % get gain respones of system 1632 | [mag_t,phase,wout] = bode(T_r_m); 1633 | % [Gm,Pm,Wcg,Wcp] = margin(w_t); 1634 | 1635 | % compute further needed parameter 1636 | omega_i_t=20.8; %from bode plot at gain -3 db 1637 | k_i_t=0.707; 1638 | 1639 | % high and low frequency gain 1640 | lfgain_t = mag_t(1); 1641 | hfgain_t = mag_t(end); 1642 | 1643 | % needed pole 1644 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t; 1645 | 1646 | % Weight definition 1647 | s = zpk('s'); 1648 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s)); 1649 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t)); 1650 | W3 = []; 1651 | 1652 | %sensitivty function values 1653 | S_o=(1/W1); 1654 | KS_o=(1/W2); 1655 | 1656 | % mixsyn shapes the singular values of the sensitivity function S 1657 | [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3); 1658 | 1659 | % Synthesis block diagram 1660 | 1661 | %Summing junctions 1662 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d'); 1663 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d'); 1664 | 1665 | %change of input names 1666 | sum_r = sumblk('r = a_z_c'); 1667 | sum_r.OutputName = {'a_z_c'}; 1668 | sum_r.InputName = {'r'}; 1669 | 1670 | sum_d = sumblk('d = a_z_d'); 1671 | sum_d.OutputName = {'a_z_d'}; 1672 | sum_d.InputName = {'d'}; 1673 | 1674 | sum_u = sumblk('u = q_s_c'); 1675 | sum_u.OutputName = {'q_s_c'}; 1676 | sum_u.InputName = {'u'}; 1677 | 1678 | %Gain Matrices 1679 | K_z = tunableGain('K_z',2,2); 1680 | K_z.Gain.Value = eye(2); 1681 | K_z.InputName = {'a_z_tmd','a_z_d'}; 1682 | K_z.OutputName = {'z_1_tild','z_2_tild'}; 1683 | 1684 | K_v = tunableGain('K_v',2,2); 1685 | K_v.Gain.Value = eye(2); 1686 | K_v.InputName = {'a_z_m_d','a_z_c'}; 1687 | K_v.OutputName = {'v_1','v_2'}; 1688 | 1689 | 1690 | % Compute orange box transfer function 1691 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'}); 1692 | 1693 | % Compute orange + Green box transfer function 1694 | 1695 | %Weight Matrices 1696 | % Component 1 1697 | Tf_ws_1 = tf(W1); 1698 | Tf_ws_1.InputName='z_1_tild'; 1699 | Tf_ws_1.OutputName='z_1'; 1700 | % Component 2 1701 | Tf_ws_2 = tf(W2); 1702 | Tf_ws_2.InputName='z_2_tild'; 1703 | Tf_ws_2.OutputName='z_2'; 1704 | 1705 | % Connceted system 1706 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'}); 1707 | 1708 | % Create Augmented Plant for H-Infinity Synthesis 1709 | % P = augw(P_s_tild,W1,W2); 1710 | %total number of controller inputs 1711 | NMEAS=2; 1712 | % total number of controller outputs 1713 | NCON=1; 1714 | 1715 | %hinfstruct 1716 | [K_F0,CL,GAM] = hinfsyn(P_s,NMEAS,NCON); 1717 | 1718 | % obtaining the decomposed control system gains 1719 | K_dr=K_F0(1); 1720 | K_cf=K_F0(2); 1721 | 1722 | % minimal control orders 1723 | K_dr=tf(minreal(K_dr)); 1724 | K_cf=tf(minreal(K_cf)); 1725 | 1726 | % obtain converted controllers (calculated by hand) 1727 | % Kprime_cf=K_cf/K_dr; 1728 | % Kprime_dr=1/(1-G_in.NominalValue*K_dr-G_in.NominalValue); 1729 | 1730 | % obtain converted controllers 1731 | Kprime_cf=K_cf/K_dr; 1732 | Kprime_dr=-K_dr; 1733 | 1734 | % Controller analysis 1735 | 1736 | % order of the controller 1737 | order(Kprime_cf); 1738 | order(Kprime_dr); 1739 | 1740 | 1741 | % poles and zeros of the controller 1742 | figure 1743 | iopzplot(Kprime_cf); 1744 | figure 1745 | iopzplot(Kprime_dr); 1746 | 1747 | 1748 | % frequency behaviour of the controllers 1749 | figure 1750 | bode(Kprime_cf); 1751 | figure 1752 | bode(Kprime_dr); 1753 | 1754 | % Controller Reduction 1755 | Kprime_cf_red =reduce(Kprime_cf,3); 1756 | Kprime_dr_red =reduce(Kprime_dr,3); 1757 | 1758 | 1759 | % Controller analysis 1760 | 1761 | % saving directory 1762 | mkdir('./img/Cell_2_1_F'); 1763 | 1764 | 1765 | % order of the controller 1766 | order(Kprime_cf_red); 1767 | order(Kprime_dr_red); 1768 | 1769 | 1770 | % poles and zeros of the controller 1771 | figure 1772 | iopzplot(Kprime_cf); 1773 | title("Zeros and Poles - Kprime_cf"); 1774 | print('./img/Cell_2_1_F/zero_poles_K_cf','-dsvg'); 1775 | 1776 | figure 1777 | iopzplot(Kprime_dr); 1778 | title("Zeros and Poles - Kprime_dr"); 1779 | print('./img/Cell_2_1_F/zero_poles_K_dr','-dsvg'); 1780 | 1781 | % frequency behaviour of the controllers 1782 | figure 1783 | bode(Kprime_cf); 1784 | title("Bode Plot - Kprime_cf"); 1785 | print('./img/Cell_2_1_F/bode_K_cf','-dsvg'); 1786 | 1787 | figure 1788 | bode(Kprime_dr); 1789 | title("Bode Plo - Kprime_dr"); 1790 | print('./img/Cell_2_1_F/bode_K_dr','-dsvg'); 1791 | 1792 | % sigma values 1793 | figure 1794 | sigma(Kprime_cf_red,'r-',Kprime_dr_red,'c-',Kprime_cf,'k-',Kprime_dr,'g-') 1795 | legend('Kprime_cf-reduced','Kprime_dr-reduced','Kprime_dr','Kprime_dr','Location','Northwest') 1796 | title("Simngular Values - Full and Reduced Order"); 1797 | print('./img/Cell_2_1_F/sigma_red_com','-dsvg'); 1798 | 1799 | %% ================================================================================================== 1800 | % %% Cell for Question 2.1 G): Controller Implementation 1801 | %% ================================================================================================== 1802 | % This Task has been done in Simulink --> Main_Simulink File 1803 | 1804 | % only plots are generated here from dataloging 1805 | 1806 | 1807 | % Used variable is a datalog array and therefore not usable anymore 1808 | 1809 | % step resonse 1810 | % figure 1811 | % plot(solution_2_1_G(:,2)) 1812 | % legend('Kprime_cf-reduced','Location','Northwest') 1813 | % title("Step Response of "); 1814 | % print('./img/Cell_2_1_G/sigma_red_com','-dsvg'); 1815 | % 1816 | % % step resonse 1817 | % figure 1818 | % plot(solution_2_1_G(:,3)) 1819 | % legend('Kprime_cf-reduced','Location','Northwest') 1820 | % title("Step Response of "); 1821 | % print('./img/Cell_2_1_G/sigma_red_com','-dsvg'); 1822 | % 1823 | % % step resonse 1824 | % figure 1825 | % plot(solution_2_1_G(:,4)) 1826 | % legend('Kprime_cf-reduced','Location','Northwest') 1827 | % title("Step Response of "); 1828 | % print('./img/Cell_2_1_G/sigma_red_com','-dsvg'); 1829 | % 1830 | % % step resonse 1831 | % figure 1832 | % plot(solution_2_1_G(:,end)) 1833 | % legend('Kprime_cf-reduced','Location','Northwest') 1834 | % title("Step Response of "); 1835 | % print('./img/Cell_2_1_G/sigma_red_com','-dsvg'); 1836 | 1837 | %% ================================================================================================== 1838 | % Cell for Question 3 a): Basic Robustness Analysis 1839 | %% ================================================================================================== 1840 | % This Task has been done in Simulink --> Simulink Control Design 1841 | % Please Have look on the Main_Simulink File for further understanding 1842 | 1843 | %% ================================================================================================== 1844 | % Cell for Question 3 b): Advanced Robustness Analysis 1845 | %% ================================================================================================== 1846 | 1847 | % Open Simulink Model and load it 1848 | sim('Question_3'); 1849 | sim_mod = 'Question_3'; 1850 | 1851 | % Get the analysis Input and Outputs 1852 | io = getlinio(sim_mod); 1853 | 1854 | % Defining operating point 1855 | op = operpoint(sim_mod); 1856 | 1857 | % Linearize the model 1858 | M = linearize(sim_mod,io,op); 1859 | 1860 | M.InputName={'u1','u2'}; 1861 | M.OutputName={'y1','y2'}; 1862 | 1863 | % Mu Analysis 1864 | norm(M,Inf); 1865 | 1866 | % get mu bounds 1867 | omega = logspace(-1,2,50); 1868 | M_g = frd(M,omega); 1869 | mubnds = mussv(M_g,BLK); 1870 | 1871 | % saving directory 1872 | mkdir('./img/Cell_3_B'); 1873 | 1874 | % plot mu bounds 1875 | figure() 1876 | LinMagopt = bodeoptions; 1877 | LinMagopt.PhaseVisible = 'off'; 1878 | LinMagopt.MagUnits = 'abs'; 1879 | bodeplot(mubnds(1,1),mubnds(1,2),LinMagopt); 1880 | xlabel('Frequency (rad/sec)'); 1881 | ylabel('Mu upper/lower bounds'); 1882 | title('Mu plot of robust stability margins (inverted scale)'); 1883 | print('./img/Cell_3_B/mu_plot','-dsvg'); 1884 | 1885 | 1886 | % get minimums and maximums of mu bounds 1887 | [pkl,wPeakLow] = getPeakGain(mubnds(1,2)); 1888 | [pku] = getPeakGain(mubnds(1,1)); 1889 | SMfromMU.LowerBound = 1/pku; 1890 | SMfromMU.UpperBound = 1/pkl; 1891 | SMfromMU.CriticalFrequency = wPeakLow; 1892 | 1893 | % show values 1894 | SMfromMU; 1895 | 1896 | 1897 | 1898 | 1899 | 1900 | -------------------------------------------------------------------------------- /Main_Simulink.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/Main_Simulink.slx -------------------------------------------------------------------------------- /Main_Simulink.slxc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/Main_Simulink.slxc -------------------------------------------------------------------------------- /Question_3.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/Question_3.slx -------------------------------------------------------------------------------- /Question_3.slxc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/Question_3.slxc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Autonomous Control Systems Assignment - Autonomous Vehicle Dynamics and Control, Cranfield University 2 | 3 |
4 |
5 |
6 | This repository contains MATLAB/Simulink simulation software for the flight dynamic simulation and robust control of a transonic missile system.
7 |
8 | ### Description
9 | This Software Project was created as part of the Autonomous Control Systems module, which was held by Dr. Hyo-Sang Shin, Cranfield University, and Dr. Spilios Theodoulis, French-German Research Institute of Saint-Louis for the students of the master's course Autonomous Vehicle Dynamics and Control at Cranfield University. This repository contains the MATLAB/Simulink software in which a transonic missile's longitudinal flight dynamic model has been augmented with uncertainties and afterward analyzed.
10 |
11 |
12 |
13 |
14 | The problem presented in this assignment was the robust control of a transonic missile model with modeling uncertainties in MATLAB/Simulink. The lecturer has provided the linearised system and information about the uncertainties. This work was mainly on developing the required control law for which the robust control toolbox of MATLAB has been utilized.
15 |
16 |
17 |
18 |
19 | ### Structure
20 | This assignment aims to develop a robust control system for a specified
21 | missile by using MATLAB/Simulink. This general aim can be separated into six primary
22 | objectives:
23 |
24 | * Derivation of flight dynamic state-space equations of a missile
25 | * Establishing a parametric uncertain model in Matlab
26 | * Development and tuning of unstructured feedback loop
27 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_1_1_A.m:
--------------------------------------------------------------------------------
1 | %% ==================================================================================================
2 | % %% Cell for Question 1.1 a): Creating the System Model for the nominal and the uncertain System
3 | %% ==================================================================================================
4 |
5 | %%====== Nominal Model
6 | %Defining Variables
7 | Z_alpha=-1231.914;
8 | M_q=0;
9 | Z_delta=-107.676;
10 | A_alpha=-1429.131;
11 | A_delta=-114.59;
12 | V=947.684;
13 | g=9.81;
14 | omega_a=150;
15 | zeta_a=0.7;
16 |
17 | %uncertain parameters
18 | M_alpha=-299.26;
19 | M_delta=-130.866;
20 |
21 | %%Defining the Actuator System Matrices
22 | A_ac_n= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
23 | B_ac_n= [ (0); (omega_a^2)];
24 | C_ac_n= [ (1) 0];
25 | D_ac_n= 0;
26 |
27 | %Creating State Space System Model
28 | Gss_ac_n = ss(A_ac_n,B_ac_n,C_ac_n,D_ac_n,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
29 |
30 |
31 | %% Defining the Airframe System Matrices
32 | A_af_n= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af_n= [ (Z_delta/V); (M_delta)];
34 | C_af_n= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af_n= [A_delta/g 0]';
37 |
38 | %Creating State Space System Model
39 | Gss_af_n = ss(A_af_n,B_af_n,C_af_n,D_af_n,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se_n= [0 0; 0 0];
44 | B_se_n= [0 0; 0 0];
45 | C_se_n= [0 0;0 0];
46 | D_se_n= [1 0; 0 1];
47 |
48 | Gss_se_n = ss(A_se_n,B_se_n,C_se_n,D_se_n,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %%Combining the Models
51 | T_n = connect(Gss_af_n,Gss_ac_n,Gss_se_n,'\delta_q_c',{'a_z_m','q_m'});
52 |
53 | %computing poles
54 | p_n= pole(T_n)
55 |
56 | %computing zeros
57 | z_n = zero(T_n)
58 |
59 | %computing daming of nominal model
60 | eig(T_n);
61 | damp(T_n);
62 |
63 | %% Creating and Saving Plots
64 | % saving directory
65 | mkdir('./img/Cell_1_1_A');
66 |
67 | %step response of nominal system
68 | figure
69 | step(T_n)
70 | title("Step Response - Nominal System");
71 | print('./img/Cell_1_1_A/Step_Nom','-dsvg');
72 |
73 | %impulse response of nominal system
74 | figure
75 | impulse(T_n)
76 | title("Impulse Response - Nominal System");
77 | print('./img/Cell_1_1_A/Impulse_Nom','-dsvg');
78 |
79 | % Bode plot of nominal system
80 | figure
81 | bode(T_n)
82 | title("Bode Diagram - Uncertain System");
83 | print('./img/Cell_1_1_A/Bode_Un','-dsvg');
84 |
85 | %impulse response of uncertain system
86 | figure
87 | nyquist(T_n)
88 | title("Nyquist Diagram - Nominal System");
89 | print('./img/Cell_1_1_A/Nyquist_Nom','-dsvg');
90 |
91 |
92 | %ploting the poles and zeros
93 | figure
94 | iopzplot(T_n(1));
95 | title("Z-Plane Diagram - Nominal System a_z");
96 | print('./img/Cell_1_1_A/ZPlane_a_z_Nom','-dsvg');
97 |
98 | %ploting the poles and zeros
99 | figure
100 | iopzplot(T_n(2));
101 | title("Z-Plane Diagram - Nominal System q");
102 | print('./img/Cell_1_1_A/ZPlane_q_Nom','-dsvg');
103 |
104 |
105 |
106 | %%%========================================================================
107 | %%%========================================================================
108 |
109 | %====== Uncertain Model
110 |
111 | % Defining Variables
112 | Z_alpha=-1231.914;
113 | M_q=0;
114 | Z_delta=-107.676;
115 | A_alpha=-1429.131;
116 | A_delta=-114.59;
117 | V=947.684;
118 | g=9.81;
119 | omega_a=150;
120 | zeta_a=0.7;
121 | r_M_alpha=57.813;
122 | r_M_delta=32.716;
123 |
124 | % Uncertain parameters
125 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
126 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
127 |
128 | %Defining the Actuator System Matrices of Actuators
129 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
130 | B_ac= [ (0); (omega_a^2)];
131 | C_ac= [ (1); 0]';
132 | D_ac= 0;
133 |
134 | % Creating State Space System Model
135 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
136 |
137 | % Defining the Airframe System Matrices
138 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
139 | B_af= [ (Z_delta/V); (M_delta)];
140 | C_af= [ (A_alpha/g) 0 ;
141 | 0 1 ]';
142 | D_af= [A_delta/g 0]';
143 |
144 | % Creating State Space System Model of Airframe
145 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
146 |
147 |
148 | %% Defining the Sesnsor System Matrices
149 | A_se= [0 0; 0 0];
150 | B_se= [0 0; 0 0];
151 | C_se= [0 0;0 0];
152 | D_se= [1 0; 0 1];
153 |
154 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
155 |
156 |
157 | %Combining the Models
158 | T1 = connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'});
159 |
160 | % computing daming of unvertain model
161 | eig(T1);
162 | damp(T1);
163 |
164 |
165 | %% Creating and Saving Plots
166 |
167 | % step response of uncertain system
168 | figure
169 | step(T1)
170 | title("Step Response - Uncertain System");
171 | print('./img/Cell_1_1_A/Step_Un','-dsvg');
172 |
173 | % impulse response of unvertain system
174 | figure
175 | impulse(T1)
176 | title("Impulse Response - Uncertain System");
177 | print('./img/Cell_1_1_A/Impulse_Un','-dsvg');
178 |
179 | % Bode plot
180 | figure
181 | bode(T1)
182 | title("Bode Diagram - Uncertain System");
183 | print('./img/Cell_1_1_A/Bode_Un','-dsvg');
184 |
185 | % nyquist plot
186 | figure
187 | nyquist(T1)
188 | title("Nyquist Diagram - Uncertain System");
189 | print('./img/Cell_1_1_A/Nyquist_Un','-dsvg');
190 |
191 |
192 | % ploting the poles and zeros
193 | %for output az
194 | figure
195 | iopzplot(T1(1));
196 | title("Z-Plane Diagram - Uncertain System a_z");
197 | print('./img/Cell_1_1_A/ZPlane_az_Un','-dsvg');
198 |
199 | %for output q
200 | figure
201 | iopzplot(T1(2));
202 | title("Z-Plane Diagram - Uncertain System q");
203 | print('./img/Cell_1_1_A/ZPlane_q_Un','-dsvg');
204 |
205 | % legend('RMSE', 'CRLB')
206 | % title('EKF RMSE (m)')
207 | % xlabel('Time step')
208 | % ylabel('RMSE (m)')
209 | % print('./Graphs/EKF','-dsvg')
210 |
211 |
212 |
213 |
214 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_1_1_B.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | % %% Cell for Question 1.1 b): LFT model
3 |
4 | %====== Uncertain Model
5 |
6 | % Defining Variables
7 | Z_alpha=-1231.914;
8 | M_q=0;
9 | Z_delta=-107.676;
10 | A_alpha=-1429.131;
11 | A_delta=-114.59;
12 | V=947.684;
13 | g=9.81;
14 | omega_a=150;
15 | zeta_a=0.7;
16 | r_M_alpha=57.813;
17 | r_M_delta=32.716;
18 |
19 | % Uncertain parameters
20 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
21 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
22 |
23 | % Defining the Airframe System Matrices
24 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
25 | B_af= [ (Z_delta/V); (M_delta)];
26 | C_af= [ (A_alpha/g) 0 ;
27 | 0 1 ]';
28 | D_af= [A_delta/g 0]';
29 |
30 | % Creating State Space System Model of Airframe
31 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
32 |
33 | %% Decomposing Uncertain Objects Decomposing Uncertain Objects
34 | [M,Delta] = lftdata(Gss_af)
35 |
36 | % LFT State Space System
37 | LFT = ss(M);
38 |
39 | %Simplify
40 | ssLFT=simplify(LFT,'full')
41 |
42 | %% Validation: Theoreticly Expected Matrices
43 | A_est= [ (Z_alpha/V) 1 ; (M_alpha.NominalValue) (M_q)];
44 | B_est= [ 0 0 (Z_delta/V);
45 | sqrt(-M_alpha.NominalValue*(r_M_alpha/100)) sqrt(-M_delta.NominalValue*(r_M_delta/100)) M_delta.NominalValue];
46 | C_est= [ sqrt(-M_alpha.NominalValue*(r_M_alpha/100)) 0 ;
47 | 0 0 ;
48 | (A_alpha/g) 0 ;
49 | 0 1 ];
50 | D_est= [ 0 0 0 ;
51 | 0 0 sqrt(-M_delta.NominalValue*(r_M_delta/100));
52 | 0 0 (A_delta/g) ;
53 | 0 0 0 ];
54 |
55 | % Comparision with compute H matrix elements (Succesful validation: All matrix elements equals zero)
56 | Zero_A= A_est-ssLFT.A
57 | Zero_B= B_est-ssLFT.B
58 | Zero_C= C_est-ssLFT.C
59 | Zero_D= D_est-ssLFT.D
60 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_1_2_A.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 1.2 a): Uncertain inner loop state space model
3 |
4 | %% Step : Inner Loop Gain
5 | % Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | % %%Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.25;%-0.165;%0.00782; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Open Loop System
60 | T_open = ss(connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'}));
61 |
62 | %% Open Loop Response Analysis
63 |
64 | % Saving Plotsin directory
65 | mkdir('./img/Cell_1_2_A');
66 |
67 | % Nyquist - Uncertain
68 | figure
69 | nyquist(T_open(1))
70 | hold on
71 | nyquist(-T_open(1))
72 | title("Open Loop Root Locus - Uncertain System");
73 | print('./img/Cell_1_2_A/open_nyquist_unc','-dsvg');
74 |
75 | % Nyquist - nominal
76 | figure
77 | nyquist(ss(T_open(1)))
78 | hold on
79 | nyquist(ss(-T_open(1)))
80 | title("Open Loop Root Locus - Uncertain System");
81 | print('./img/Cell_1_2_A/open_nyquist_nom','-dsvg');
82 |
83 | % Root Locus - Uncertain
84 | figure
85 | rlocus(T_open(1))
86 | zeta=0.707
87 | sgrid(zeta,20000)
88 | title("Open Loop Root Locus - Uncertain System");
89 | print('./img/Cell_1_2_A/open_rlocus_unc','-dsvg');
90 |
91 | % Root Locus - Nominal
92 | figure
93 | rlocus(ss(T_open(1)))
94 | zeta=0.707
95 | sgrid(zeta,20000)
96 | title("Open Loop Root Locus - Nominal System");
97 | print('./img/Cell_1_2_A/open_rlocus_nom','-dsvg');
98 |
99 | % Step response of the uncertain system
100 | figure
101 | step(T_open)
102 | title("Open Loop Step Response - Nominal System");
103 | print('./img/Cell_1_2_A/open_step_unc','-dsvg');
104 |
105 | % Step response of the nominal system
106 | figure
107 | step(ss(T_open))
108 | title("Open Loop Step Response - Nominal System");
109 | print('./img/Cell_1_2_A/open_step_nom','-dsvg');
110 |
111 | %% Inner Loop System
112 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
113 |
114 | %% Inner Loop Response Analysis: Computing gains for damping = 0.7 of SISO uncertain model q_c --> a_z
115 |
116 | %Root Locus - uncertain
117 | figure
118 | rlocus(T_inner(1))
119 | zeta=0.707
120 | sgrid(zeta,20000)
121 | title("Inner Loop Root Locus - Uncertain System");
122 | print('./img/Cell_1_2_A/inner_rlocus_unc','-dsvg');
123 |
124 | %Root Locus - nominal
125 | figure
126 | rlocus(ss(T_inner(1)))
127 | zeta=0.707
128 | sgrid(zeta,20000)
129 | title("Inner Loop Root Locus - Nominal System");
130 | print('./img/Cell_1_2_A/inner_rlocus_nom','-dsvg');
131 |
132 | %step response of the uncertain system
133 | figure
134 | step(T_inner)
135 | title("Inner Loop Step Response - Nominal System");
136 | print('./img/Cell_1_2_A/inner_step_unc','-dsvg');
137 |
138 | %step response of the nominal system
139 | figure
140 | step(ss(T_inner))
141 | title("Inner Loop Step Response - Nominal System");
142 | print('./img/Cell_1_2_A/inner_step_nom','-dsvg');
143 |
144 | %%%========================================================================
145 | %% Step : Outter Loop Gain
146 |
147 | % %Definition of Gain for outter Loop
148 | K_s_c = tunableGain('K_s_c',1,1);
149 | steady_state_gain = 1/dcgain(T_inner);
150 | K_s_c.Gain.Value = steady_state_gain(1);
151 | K_s_c.InputName = 'q_s_c';
152 | K_s_c.OutputName = 'q_c';
153 |
154 | % Combining the Models
155 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
156 |
157 | %% Outter Loop Response Analysis
158 | %step response of the uncertain system
159 | figure
160 | step(T_outter)
161 | title("Outter Loop Step Response - Uncertain System");
162 | print('./img/Cell_1_2_A/outter_step_unc','-dsvg');
163 |
164 | %step response of the nominal system
165 | figure
166 | step(ss(T_outter))
167 | title("Outter Loop Step Response - Nominal System");
168 | print('./img/Cell_1_2_A/outter_step_nom','-dsvg');
169 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_1_2_A_conn.asv:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 1.2 a): Uncertain inner loop state space model
3 |
4 | %% Step : Inner Loop Gain
5 | % Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | % %%Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.25;%-0.165;%0.00782; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Open Loop System
60 | T_open = ss(connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'}));
61 |
62 | %% Open Loop Response Analysis
63 |
64 | % Saving Plotsin directory
65 | mkdir('./img/Cell_1_2_A');
66 |
67 | % Root Locus - Uncertain
68 | figure
69 | rlocus(T_open(1))
70 | zeta=0.707
71 | sgrid(zeta,20000)
72 | title("Open Loop Root Locus - Uncertain System");
73 | print('./img/Cell_1_1_A/open_rlocus_unc','-dsvg');
74 |
75 | % Root Locus - Nominal
76 | figure
77 | rlocus(ss(T_open(1)))
78 | zeta=0.707
79 | sgrid(zeta,20000)
80 | title("Open Loop Root Locus - Nominal System");
81 | print('./img/Cell_1_1_A/open_rlocus_nom','-dsvg');
82 |
83 | % Step response of the uncertain system
84 | figure
85 | step(T_open)
86 | title("Open Loop Step Response - Nominal System");
87 | print('./img/Cell_1_1_A/open_step_unc','-dsvg');
88 |
89 | % Step response of the nominal system
90 | figure
91 | step(ss(T_open))
92 | title("Open Loop Step Response - Nominal System");
93 | print('./img/Cell_1_1_A/open_step_nom','-dsvg');
94 |
95 | %% Inner Loop System
96 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
97 |
98 | %% Inner Loop Response Analysis: Computing gains for damping = 0.7 of SISO uncertain model q_c --> a_z
99 |
100 | %Root Locus - uncertain
101 | figure
102 | rlocus(T_inner(1))
103 | zeta=0.707
104 | sgrid(zeta,20000)
105 | title("Inner Loop Root Locus - Uncertain System");
106 | print('./img/Cell_1_1_A/inner_rlocus_unc','-dsvg');
107 |
108 | %Root Locus - nominal
109 | figure
110 | rlocus(ss(T_inner(1)))
111 | zeta=0.707
112 | sgrid(zeta,20000)
113 | title("Inner Loop Root Locus - Nominal System");
114 | print('./img/Cell_1_1_A/inner_rlocus_nom','-dsvg');
115 |
116 | %step response of the uncertain system
117 | figure
118 | step(T_inner)
119 | title("Inner Loop Step Response - Nominal System");
120 | print('./img/Cell_1_1_A/inner_step_unc','-dsvg');
121 |
122 | %step response of the nominal system
123 | figure
124 | step(ss(T_inner))
125 | title("Inner Loop Step Response - Nominal System");
126 | print('./img/Cell_1_1_A/inner_step_nom','-dsvg');
127 |
128 | %%%========================================================================
129 | %% Step : Outter Loop Gain
130 |
131 | % %Definition of Gain for outter Loop
132 | K_s_c = tunableGain('K_s_c',1,1);
133 | steady_state_gain = 1/dcgain(T_inner);
134 | K_s_c.Gain.Value = steady_state_gain(1);
135 | K_s_c.InputName = 'q_s_c';
136 | K_s_c.OutputName = 'q_c';
137 |
138 | % Combining the Models
139 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
140 |
141 | %% Outter Loop Response Analysis
142 | %step response of the uncertain system
143 | figure
144 | step(T_outter)
145 | title("Outter Loop Step Response - Uncertain System");
146 | print('./img/Cell_1_1_A/outter_step_unc','-dsvg');
147 |
148 | %step response of the nominal system
149 | figure
150 | step(ss(T_outter))
151 | title("Outter Loop Step Response - Nominal System");
152 | print('./img/Cell_1_1_A/outter_step_nom','-dsvg');
153 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_1_2_B.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 1.2 b): Uncertain inner loop state space model
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Definition of Gain for outter Loop
60 | K_s_c = tunableGain('K_s_c',1,1);
61 | steady_state_gain = 1/dcgain(T_inner);
62 | K_s_c.Gain.Value = steady_state_gain(1);
63 | K_s_c.Gain.Value = 2.3761;
64 | K_s_c.InputName = 'q_s_c';
65 | K_s_c.OutputName = 'q_c';
66 |
67 | %% Connceting the Models
68 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
69 |
70 | %% Decomposing Uncertain ObjectsDecomposing Uncertain Objects
71 | [M,Delta] = lftdata(T_outter)
72 |
73 | %% Samples of uncertain state space system
74 | parray = usample(T_outter,50);
75 | parray_a_z = usample(T_outter(1),50);
76 |
77 | nom_sys=ss(T_outter);
78 |
79 | %% Creating and Saving Plots
80 | % saving directory
81 | mkdir('./img/Cell_1_2_B');
82 |
83 | %% Nominal Bode
84 | figure
85 | bode(parray,'b--',nom_sys,'r',{.1,1e3}), grid
86 | legend('Frequency response data','Nominal model','Location','NorthEast');
87 | print('./img/Cell_1_2_B/bode_Nom_Unc','-dsvg');
88 |
89 | %% Fits an uncertain model to a family of LTI models with unstructured uncertainty
90 | [P1,InfoS1] = ucover(parray_a_z,nom_sys(1),1,'InputMult');
91 | [P2,InfoS2] = ucover(parray_a_z,nom_sys(1),2,'InputMult');
92 | [P3,InfoS3] = ucover(parray_a_z,nom_sys(1),3,'InputMult');
93 | [P4,InfoS4] = ucover(parray_a_z,nom_sys(1),4,'InputMult');
94 |
95 | %% Bode plot weigthed trans function: order
96 | Gp=ss(parray_a_z);
97 | G=nom_sys(1);
98 | relerr = (Gp-G)/G;
99 | %Bode Magnjitude
100 | figure
101 | bodemag(relerr,'b',InfoS1.W1,'r-.',InfoS2.W1,'k-.',InfoS3.W1,'m-.',InfoS4.W1,'g-.',{0.1,1000});
102 | legend('(G_p-G)/G)','Lm(\omega)First-order w','Lm(\omega)Second-order w','Lm(\omega)Third-order w','Lm(\omega)Fourth-order w','Location','SouthWest');
103 | title("Singular Values")
104 | print('./img/Cell_1_2_B/bode_mag_weights','-dsvg');
105 |
106 | %% Bode plot weigthed trans function: samples
107 |
108 | %% Samples of uncertain state space system
109 | parray_a_z1 = usample(T_outter(1),10);
110 | parray_a_z2 = usample(T_outter(1),20);
111 | parray_a_z3 = usample(T_outter(1),30);
112 | parray_a_z4 = usample(T_outter(1),40);
113 |
114 | nom_sys=ss(T_outter);
115 |
116 | %% Creating and Saving Plots
117 | % saving directory
118 | mkdir('./img/Cell_1_2_B');
119 |
120 | %% Nominal Bode
121 | figure
122 | bode(parray,'b--',nom_sys,'r',{.1,1e3}), grid
123 | legend('Frequency response data','Nominal model','Location','NorthEast');
124 | print('./img/Cell_1_2_B/bode_Nom_Unc','-dsvg');
125 |
126 | %% Fits an uncertain model to a family of LTI models with unstructured uncertainty
127 | [P1,InfoS1] = ucover(parray_a_z1,nom_sys(1),2,'InputMult');
128 | [P2,InfoS2] = ucover(parray_a_z2,nom_sys(1),2,'InputMult');
129 | [P3,InfoS3] = ucover(parray_a_z3,nom_sys(1),2,'InputMult');
130 | [P4,InfoS4] = ucover(parray_a_z4,nom_sys(1),2,'InputMult');
131 |
132 | %% Bode plot weigthed trans function: order
133 | Gp=ss(parray_a_z);
134 | G=nom_sys(1);
135 | relerr = (Gp-G)/G;
136 | %Bode Magnjitude
137 | figure
138 | bodemag(relerr,'b',InfoS1.W1,'r-.',InfoS2.W1,'k-.',InfoS3.W1,'m-.',InfoS4.W1,'g-.',{0.1,1000});
139 | legend('(G_p-G)/G)','Lm(\omega)- 10 Samples','Lm(\omega) - 20 Samples','Lm(\omega) - 30 Samples','Lm(\omega)- 40 Samples','Location','SouthWest');
140 | title("Singular Values")
141 | print('./img/Cell_1_2_B/bode_mag_weights_sampels_multi','-dsvg');
142 |
143 |
144 | %%+===============================
145 | figure
146 | bode(InfoS1.W1);
147 | title('Scalar Additive Uncertainty Model')
148 | legend('First-order w','Min. uncertainty amount','Location','SouthWest');
149 | print('./img/Cell_1_2_B/bode_weights','-dsvg');
150 |
151 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_A.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 a): Verify inner loop system
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -1*0.141; %-0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% open Loop System
60 | T_open = connect(Gss_af,Gss_ac,Gss_se,'\delta_q_c',{'a_z_m','q_m'});
61 |
62 | %% Inner Loop System
63 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
64 |
65 | %% Definition of Gain for outter Loop
66 | K_s_c = tunableGain('K_s_c',1,1);
67 | steady_state_gain = 1/dcgain(T_inner);
68 | K_s_c.Gain.Value = steady_state_gain(1);
69 | K_s_c.Gain.Value = 2.3761;
70 | K_s_c.InputName = 'q_s_c';
71 | K_s_c.OutputName = 'q_c';
72 |
73 |
74 | %% Inner Loop Analysis: Computing gains for damping = 0.7 of SISO uncertain model q_c --> a_z
75 |
76 | % Saving Plotsin directory
77 | mkdir('./img/Cell_2_1_A');
78 |
79 | %getting Transferfunction of inner loop
80 | inner_tf=tf(T_inner)
81 |
82 | %ploting the poles and zeros Uncertain
83 | figure
84 | iopzplot(T_inner);
85 | title("Z-Plane Diagram - Inner Loop System");
86 | print('./img/Cell_2_1_A/ZPlane_unc','-dsvg');
87 |
88 | %ploting the poles and zeros Nominal
89 | figure
90 | iopzplot(ss(T_inner));
91 | title("Z-Plane Diagram - Inner Loop System");
92 | print('./img/Cell_2_1_A/ZPlane_nom','-dsvg');
93 |
94 | %step response of the uncertain system
95 | figure
96 | step(T_inner)
97 | title("Inner Loop Step Response - Nominal System");
98 | print('./img/Cell_1_2_A/inner_step_unc','-dsvg');
99 |
100 | % Information of Step Respomse: settling time and overshoot
101 | inner_step=stepinfo(T_inner);
102 |
103 | % Time it takes for the errors between the response y(t) and the steady-state response yfinal to fall to within 2% of yfinal.
104 | settlingTime=inner_step.SettlingTime
105 | % Percentage overshoot, relative to yfinal).
106 | overShot=inner_step.Overshoot
107 |
108 | %step response of the nominal system
109 | figure
110 | step(ss(T_inner))
111 | title("Inner Loop Step Response - Nominal System");
112 | print('./img/Cell_1_2_A/inner_step_nom','-dsvg');
113 |
114 | %% Connceting the Models
115 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_B.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 c): Weighting filter selection
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Inner Loop System
60 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
61 |
62 | %% Reference model computation:
63 | % Transfer Function Computing
64 | % tunning requirement of max. 2% overshoot
65 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009
66 |
67 | % tuning requirements of 0.2 seconcs
68 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6
69 |
70 | % definition of transfer function
71 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]);
72 |
73 | % printing relevant step information
74 | step_information = stepinfo(T_r_m)
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_C.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 b): Reference model computation
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Inner Loop System
60 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
61 |
62 | %% Reference model computation:
63 |
64 | % computing the non minimum phase zero of
65 | inner_zeros=zero(T_inner(1));
66 | z_n_m_p=inner_zeros(1);
67 |
68 | %% Parameter Computing
69 | % tunning requirement of max. 2% overshoot
70 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009
71 |
72 | % tuning requirements of 0.2 seconcs
73 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6
74 |
75 | % definition of transfer function
76 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]);
77 |
78 | %% Weighting filter selection
79 |
80 | %% Sensitivity function Analysis
81 | s_t=1-T_r_m;
82 | % get gain respones of system
83 | [mag_s,phase,wout] = bode(s_t);
84 |
85 | % compute further needed parameter
86 | omega_i_s=6.81; %from bode plot at gain -3 db
87 | k_i_s=0.707;
88 |
89 | % high and low frequency gain
90 | lfgain_s = mag_s(1);
91 | hfgain_s = mag_s(end);
92 | % needed pole
93 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s;
94 |
95 | %% Complementary sensitivity function Analysis
96 | w_t=tf(T_r_m);
97 | % w_t=tf(Gss_ac);
98 |
99 | % get gain respones of system
100 | [mag_t,phase,wout] = bode(T_r_m);
101 | % [Gm,Pm,Wcg,Wcp] = margin(w_t);
102 | % compute further needed parameter
103 | omega_i_t=20.8; %from bode plot at gain -3 db
104 | k_i_t=0.707;
105 |
106 | % high and low frequency gain
107 | lfgain_t = mag_t(1);
108 | hfgain_t = mag_t(end);
109 |
110 | % needed pole
111 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t;
112 |
113 | % weight definition
114 | s = zpk('s');
115 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s));
116 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t));
117 | W3 = [];
118 |
119 | %sensitivty function values
120 | S_o=(1/W1);
121 | KS_o=(1/W2);
122 |
123 | % mixsyn shapes the singular values of the sensitivity function S
124 | [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3);
125 |
126 | %plot of singular system diagram
127 | figure
128 | sigma(s_t,'r-',T_r_m,'c-',1/W1,'k-',1/W2,'g-')
129 | legend('S_t','T_r_m','1/W1','1/W2','Location','Northwest')
130 |
131 | figure
132 | sigma(K*s_t)
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_D.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 b): Reference model computation
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Inner Loop System
60 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
61 |
62 | %% Step : Outter Loop Gain
63 |
64 | % %Definition of Gain for outter Loop
65 | K_s_c = tunableGain('K_s_c',1,1);
66 | steady_state_gain = 1/dcgain(T_inner);
67 | K_s_c.Gain.Value = steady_state_gain(1);
68 | K_s_c.InputName = 'q_s_c';
69 | K_s_c.OutputName = 'q_c';
70 |
71 | % Combining the Models
72 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
73 |
74 | %% Reference model computation:
75 |
76 | % computing the non minimum phase zero of
77 | inner_zeros=zero(T_inner(1));
78 | z_n_m_p=inner_zeros(1);
79 |
80 | %% Parameter Computing
81 | % tunning requirement of max. 2% overshoot
82 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009
83 |
84 | % tuning requirements of 0.2 seconcs
85 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6
86 |
87 | % definition of transfer function
88 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]);
89 | T_r_m.InputName = {'a_z_c'};
90 | T_r_m.OutputName = {'a_z_t'};
91 |
92 | %% Weighting filter selection
93 |
94 | %% Sensitivity function Analysis
95 | s_t=1-T_r_m;
96 | w_s=1/s_t;
97 |
98 | % get gain respones of system
99 | [mag_s,phase,wout] = bode(s_t);
100 | % [Gm,Pm,Wcg,Wcp] = margin(w_s);
101 |
102 | % compute further needed parameter
103 | omega_i_s=6.81; %from bode plot at gain -3 db
104 | k_i_s=0.707;
105 |
106 | % high and low frequency gain
107 | lfgain_s = mag_s(1);
108 | hfgain_s = mag_s(end);
109 |
110 | % needed pole
111 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s;
112 |
113 | %% Complementary sensitivity function Analysis
114 | w_t=tf(T_r_m);
115 | % w_t=tf(Gss_ac);
116 |
117 | % get gain respones of system
118 | [mag_t,phase,wout] = bode(T_r_m);
119 | % [Gm,Pm,Wcg,Wcp] = margin(w_t);
120 |
121 | % compute further needed parameter
122 | omega_i_t=20.8; %from bode plot at gain -3 db
123 | k_i_t=0.707;
124 |
125 | % high and low frequency gain
126 | lfgain_t = mag_t(1);
127 | hfgain_t = mag_t(end);
128 |
129 | % needed pole
130 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t;
131 |
132 | % weight definition
133 | s = zpk('s');
134 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s));
135 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t));
136 | W3 = [];
137 |
138 | % mixsyn shapes the singular values of the sensitivity function S
139 | [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3);
140 |
141 | %% Synthesis block diagram
142 |
143 | %Summing junctions
144 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d');
145 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d');
146 |
147 | %change of input names
148 | sum_r = sumblk('r = a_z_c');
149 | sum_r.OutputName = {'a_z_c'};
150 | sum_r.InputName = {'r'};
151 |
152 | sum_d = sumblk('d = a_z_d');
153 | sum_d.OutputName = {'a_z_d'};
154 | sum_d.InputName = {'d'};
155 |
156 | sum_u = sumblk('u = q_s_c');
157 | sum_u.OutputName = {'q_s_c'};
158 | sum_u.InputName = {'u'};
159 |
160 | %Gain Matrices
161 | K_z = tunableGain('K_z',2,2);
162 | K_z.Gain.Value = eye(2);
163 | K_z.InputName = {'a_z_tmd','q_s_c'};
164 | K_z.OutputName = {'z_1_tild','z_2_tild'};
165 |
166 | K_v = tunableGain('K_v',2,2);
167 | K_v.Gain.Value = eye(2);
168 | K_v.InputName = {'a_z_m_d','a_z_c'};
169 | K_v.OutputName = {'v_1','v_2'};
170 |
171 |
172 | %% Compute orange box transfer function
173 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'});
174 |
175 | % Transferfunction
176 | Tf_p_s = tf(P_s_tild);
177 |
178 | %% Compute orange + Green box transfer function
179 |
180 | %Weight Matrices
181 | % Component 1
182 | Tf_ws_1 = tf(W1);
183 | Tf_ws_1.InputName='z_1_tild';
184 | Tf_ws_1.OutputName='z_1';
185 | % Component 2
186 | Tf_ws_2 = tf(W2);
187 | Tf_ws_2.InputName='z_2_tild';
188 | Tf_ws_2.OutputName='z_2';
189 |
190 | % Connceted system
191 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'});
192 |
193 | %% Give out final Transfer function
194 | tf_tild=tf(P_s_tild);
195 | tf_full=tf(P_s);
196 |
197 | %% Plot Analysis
198 | bode(P_s)
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_E.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 b): Reference model computation
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Inner Loop System
60 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
61 |
62 | %% Step : Outter Loop Gain
63 |
64 | % %Definition of Gain for outter Loop
65 | K_s_c = tunableGain('K_s_c',1,1);
66 | steady_state_gain = 1/dcgain(T_inner);
67 | K_s_c.Gain.Value = steady_state_gain(1);
68 | K_s_c.InputName = 'q_s_c';
69 | K_s_c.OutputName = 'q_c';
70 |
71 | % Combining the Models
72 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
73 |
74 | %% Reference model computation:
75 |
76 | % computing the non minimum phase zero of
77 | inner_zeros=zero(T_inner(1));
78 | z_n_m_p=inner_zeros(1);
79 |
80 | %% Parameter Computing
81 | % tunning requirement of max. 2% overshoot
82 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009
83 |
84 | % tuning requirements of 0.2 seconcs
85 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6
86 |
87 | % definition of transfer function
88 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]);
89 | T_r_m.InputName = {'a_z_c'};
90 | T_r_m.OutputName = {'a_z_t'};
91 |
92 | %% Weighting Filter Selection
93 |
94 | %% Sensitivity function Analysis
95 | s_t=1-T_r_m;
96 | w_s=1/s_t;
97 |
98 | % get gain respones of system
99 | [mag_s,phase,wout] = bode(s_t);
100 | % [Gm,Pm,Wcg,Wcp] = margin(w_s);
101 |
102 | % compute further needed parameter
103 | omega_i_s=6.81; %from bode plot at gain -3 db
104 | k_i_s=0.707;
105 |
106 | % high and low frequency gain
107 | lfgain_s = mag_s(1);
108 | hfgain_s = mag_s(end);
109 |
110 | % needed pole
111 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s;
112 |
113 | %% Complementary sensitivity function Analysis
114 | % w_t=tf(T_r_m);
115 | w_t=tf(Gss_ac);
116 |
117 | % get gain respones of system
118 | [mag_t,phase,wout] = bode(T_r_m);
119 | % [Gm,Pm,Wcg,Wcp] = margin(w_t);
120 |
121 | % compute further needed parameter
122 | omega_i_t=20.8; %from bode plot at gain -3 db
123 | k_i_t=0.707;
124 |
125 | % high and low frequency gain
126 | lfgain_t = mag_t(1);
127 | hfgain_t = mag_t(end);
128 |
129 | % needed pole
130 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t;
131 |
132 | % Weight definition
133 | s = zpk('s');
134 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s));
135 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t));
136 | W3 = [];
137 |
138 | %sensitivty function values
139 | S_o=(1/W1);
140 | KS_o=(1/W2);
141 |
142 | % mixsyn shapes the singular values of the sensitivity function S
143 | % [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3);
144 |
145 | %% Synthesis block diagram
146 |
147 | %Summing junctions
148 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d');
149 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d');
150 |
151 | %change of input names
152 | sum_r = sumblk('r = a_z_c');
153 | sum_r.OutputName = {'a_z_c'};
154 | sum_r.InputName = {'r'};
155 |
156 | sum_d = sumblk('d = a_z_d');
157 | sum_d.OutputName = {'a_z_d'};
158 | sum_d.InputName = {'d'};
159 |
160 | sum_u = sumblk('u = q_s_c');
161 | sum_u.OutputName = {'q_s_c'};
162 | sum_u.InputName = {'u'};
163 |
164 | %Gain Matrices
165 | K_z = tunableGain('K_z',2,2);
166 | K_z.Gain.Value = eye(2);
167 | K_z.InputName = {'a_z_tmd','a_z_d'};
168 | K_z.OutputName = {'z_1_tild','z_2_tild'};
169 |
170 | K_v = tunableGain('K_v',2,2);
171 | K_v.Gain.Value = eye(2);
172 | K_v.InputName = {'a_z_m_d','a_z_c'};
173 | K_v.OutputName = {'v_1','v_2'};
174 |
175 |
176 | %% Compute orange box transfer function
177 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'});
178 |
179 | %% Compute orange + Green box transfer function
180 |
181 | %Weight Matrices
182 | % Component 1
183 | Tf_ws_1 = tf(W1);
184 | Tf_ws_1.InputName='z_1_tild';
185 | Tf_ws_1.OutputName='z_1';
186 | % Component 2
187 | Tf_ws_2 = tf(W2);
188 | Tf_ws_2.InputName='z_2_tild';
189 | Tf_ws_2.OutputName='z_2';
190 |
191 | % Connceted system
192 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'});
193 |
194 | %% Create Augmented Plant for H-Infinity Synthesis
195 | % P = augw(P_s_tild,W1,W2);
196 | %total number of controller inputs
197 | NMEAS=2;
198 | % total number of controller outputs
199 | NCON=1;
200 |
201 | %hinfstruct
202 | [K_F0,CL,GAM] = hinfsyn(P_s,NMEAS,NCON);
203 |
204 | % % further parameter
205 | % S = (1-P_s(2,1)*K)^-1;
206 | % R = K*S;
207 | % T = 1-S;
208 | %
209 | % figure;
210 | % sigma(S,'m-',K_F0*S,'g-');
211 | % legend('S_0','K*S_0','Location','Northwest');
212 |
213 | figure;
214 | bode(K_F0(2),'m-',CL,'g-');
215 |
216 | % obtaining the decomposed control system gains
217 | K_dr=K_F0(1);
218 | K_cf=K_F0(2);
219 |
220 | % minimal control orders
221 | ordDr=tf(minreal(K_dr));
222 | ordCf=tf(minreal(K_cf));
223 |
224 | % Weighted closed loop transfer matrix components
225 | T_r_z1 = tf(P_s(1,1));
226 | T_d_z1 = tf(P_s(1,2));
227 | T_r_z2 = tf(P_s(2,1));
228 | T_d_z2 = tf(P_s(2,2));
229 |
230 | % Unweighted closed loop transfer matrix components
231 | UT_r_z1 = tf(P_s_tild(1,1));
232 | UT_d_z1 = tf(P_s_tild(1,2));
233 | UT_r_z2 = tf(P_s_tild(2,1));
234 | UT_d_z2 = tf(P_s_tild(2,2));
235 |
236 | % performance level
237 | perf_level=hinfnorm(CL);
238 |
239 | % plot T_wTOztilda and superimpose it with inverse of weight functions
240 | figure()
241 | subplot(2,2,1)
242 | sigma(UT_r_z1)
243 | grid on
244 | hold on
245 | sigma(UT_r_z1*S_o)
246 | sigma(UT_r_z1*KS_o)
247 | hold off
248 | title('Input: r Output: z_tilda_1')
249 |
250 | subplot(2,2,2)
251 | sigma(UT_d_z1)
252 | grid on
253 | hold on
254 | sigma(UT_d_z1*S_o)
255 | sigma(UT_d_z1*KS_o)
256 | hold off
257 | title('Input: d Output: z_tilda_1')
258 |
259 | subplot(2,2,3)
260 | sigma(UT_r_z2)
261 | grid on
262 | hold on
263 | sigma(UT_r_z2*S_o)
264 | sigma(UT_r_z2*KS_o)
265 | hold off
266 | title('Input: r Output: z_tilda_2')
267 |
268 | subplot(2,2,4)
269 | sigma(UT_d_z2)
270 | grid on
271 | hold on
272 | sigma(UT_d_z2*S_o)
273 | sigma(UT_d_z2*KS_o)
274 | hold off
275 | title('Input: d Output: z_tilda_2')
276 |
277 | %adaption of different weight filter adaptions
278 | % figure()
279 | % for i=1:0.5:10
280 | % % prior weightaning bandwidth
281 | % omega_prime1=sqrt((M_h1^2-k1^2)/(k1^2-M_l1^2))*i;
282 | % W1=tf([1,omega_prime1],[M_h1,omega_prime1*M_l1]);
283 | %
284 | % S_o=(1/W1);
285 | % bode(S_o,'k')
286 | % hold on
287 | % % sigma(T_wTOztilda(1,1)*S_o,'k')
288 | % % hold on
289 | % % sigma(T_wTOztilda(1,2)*S_o,'k')
290 | % % hold on
291 | % end
292 | % hold off
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
--------------------------------------------------------------------------------
/Single Modules/Cell_II_2_1_F.m:
--------------------------------------------------------------------------------
1 | %%%========================================================================
2 | %% Cell for Question 2.1 b): Reference model computation
3 |
4 | %% Step : Inner Loop Gain
5 | %% Defining Variables
6 | Z_alpha=-1231.914;
7 | M_q=0;
8 | Z_delta=-107.676;
9 | A_alpha=-1429.131;
10 | A_delta=-114.59;
11 | V=947.684;
12 | g=9.81;
13 | omega_a=150;
14 | zeta_a=0.7;
15 | r_M_alpha=57.813;
16 | r_M_delta=32.716;
17 |
18 | % Uncertain parameters
19 | M_alpha=ureal('M_alpha',-299.26,'Percentage',[-r_M_alpha, +r_M_alpha]);
20 | M_delta=ureal('M_delta',-130.866,'Percentage',[-r_M_delta, +r_M_delta]);
21 |
22 | %% Defining the Actuator System Matrices of Actuators
23 | A_ac= [ 0 1 ; (-omega_a^2) (-2*zeta_a*omega_a)];
24 | B_ac= [ (0); (omega_a^2)];
25 | C_ac= [ (1); 0]';
26 | D_ac= 0;
27 |
28 | % Creating State Space System Model
29 | Gss_ac = ss(A_ac,B_ac,C_ac,D_ac,'StateName',{'\delta_q','\delta_q_dot'},'InputName',{'\delta_q_c'},'OutputName',{'\delta_q'});
30 |
31 | % Defining the Airframe System Matrices
32 | A_af= [ (Z_alpha/V) 1 ; (M_alpha) (M_q)];
33 | B_af= [ (Z_delta/V); (M_delta)];
34 | C_af= [ (A_alpha/g) 0 ;
35 | 0 1 ]';
36 | D_af= [A_delta/g 0]';
37 |
38 | % Creating State Space System Model of Airframe
39 | Gss_af = ss(A_af,B_af,C_af,D_af,'StateName',{'alpha','q'},'InputName',{'\delta_q'},'OutputName',{'a_z','q'});
40 |
41 |
42 | %% Defining the Sesnsor System Matrices
43 | A_se= [0 0; 0 0];
44 | B_se= [0 0; 0 0];
45 | C_se= [0 0;0 0];
46 | D_se= [1 0; 0 1];
47 |
48 | Gss_se = ss(A_se,B_se,C_se,D_se,'StateName',{'alpha','q'},'InputName',{'a_z','q'},'OutputName',{'a_z_m','q_m'});
49 |
50 | %% Definition of inner loop Gain Kq
51 | K_q = tunableGain('K_q',1,1);
52 | K_q.Gain.Value = -0.165; %0.00782
53 | K_q.InputName = 'e_q';
54 | K_q.OutputName = '\delta_q_c';
55 |
56 | %Summing junction
57 | Sum = sumblk('e_q = q_c - q_m');
58 |
59 | %% Inner Loop System
60 | T_inner = connect(Gss_af,Gss_ac,Gss_se,K_q,Sum,'q_c',{'a_z_m','q_m'});
61 |
62 | %% Step : Outter Loop Gain
63 |
64 | % %Definition of Gain for outter Loop
65 | K_s_c = tunableGain('K_s_c',1,1);
66 | steady_state_gain = 1/dcgain(T_inner);
67 | K_s_c.Gain.Value = steady_state_gain(1);
68 | K_s_c.InputName = 'q_s_c';
69 | K_s_c.OutputName = 'q_c';
70 |
71 | % Combining the Models
72 | T_outter = connect(Gss_af,Gss_ac,Gss_se,K_q,K_s_c,Sum,'q_s_c',{'a_z_m','q_m'});
73 |
74 | %% Reference model computation:
75 |
76 | % computing the non minimum phase zero of
77 | inner_zeros=zero(T_inner(1));
78 | z_n_m_p=inner_zeros(1);
79 |
80 | %% Parameter Computing
81 | % tunning requirement of max. 2% overshoot
82 | zeta_r_m = (-log(0.02))/(sqrt(pi^2+log(0.02)^2))+0.009
83 |
84 | % tuning requirements of 0.2 seconcs
85 | w_r_m = -log(0.02*sqrt(1-zeta_r_m^2))/(zeta_r_m*0.2)-7.6
86 |
87 | % definition of transfer function
88 | T_r_m = tf([((-w_r_m^2)/z_n_m_p) w_r_m^2],[1 2*zeta_r_m*w_r_m w_r_m^2]);
89 | T_r_m.InputName = {'a_z_c'};
90 | T_r_m.OutputName = {'a_z_t'};
91 |
92 | %% Weighting Filter Selection
93 |
94 | %% Sensitivity function Analysis
95 | s_t=1-T_r_m;
96 | w_s=1/s_t;
97 |
98 | % get gain respones of system
99 | [mag_s,phase,wout] = bode(s_t);
100 | % [Gm,Pm,Wcg,Wcp] = margin(w_s);
101 |
102 | % compute further needed parameter
103 | omega_i_s=6.81; %from bode plot at gain -3 db
104 | k_i_s=0.707;
105 |
106 | % high and low frequency gain
107 | lfgain_s = mag_s(1);
108 | hfgain_s = mag_s(end);
109 |
110 | % needed pole
111 | omega_i_stroke_s = sqrt((hfgain_s^2-k_i_s^2)/(k_i_s^2-lfgain_s^2))*omega_i_s;
112 |
113 | %% Complementary sensitivity function Analysis
114 | % w_t=tf(T_r_m);
115 | w_t=tf(Gss_ac);
116 |
117 | % get gain respones of system
118 | [mag_t,phase,wout] = bode(T_r_m);
119 | % [Gm,Pm,Wcg,Wcp] = margin(w_t);
120 |
121 | % compute further needed parameter
122 | omega_i_t=20.8; %from bode plot at gain -3 db
123 | k_i_t=0.707;
124 |
125 | % high and low frequency gain
126 | lfgain_t = mag_t(1);
127 | hfgain_t = mag_t(end);
128 |
129 | % needed pole
130 | omega_i_stroke_t = sqrt((hfgain_t^2-k_i_t^2)/(k_i_t^2-lfgain_t^2))*omega_i_t;
131 |
132 | % Weight definition
133 | s = zpk('s');
134 | W1 = inv((hfgain_s*s+omega_i_stroke_s*lfgain_s)/(s+omega_i_stroke_s));
135 | W2 = inv((hfgain_t*s+omega_i_stroke_t*lfgain_t)/(s+omega_i_stroke_t));
136 | W3 = [];
137 |
138 | %sensitivty function values
139 | S_o=(1/W1);
140 | KS_o=(1/W2);
141 |
142 | % mixsyn shapes the singular values of the sensitivity function S
143 | % [K,CL,GAM] = mixsyn(T_r_m,W1,W2,W3);
144 |
145 | %% Synthesis block diagram
146 |
147 | %Summing junctions
148 | Sum_a_in = sumblk('a_z_m_d = a_z_m + a_z_d');
149 | Sum_a_rm = sumblk('a_z_tmd = a_z_t- a_z_m_d');
150 |
151 | %change of input names
152 | sum_r = sumblk('r = a_z_c');
153 | sum_r.OutputName = {'a_z_c'};
154 | sum_r.InputName = {'r'};
155 |
156 | sum_d = sumblk('d = a_z_d');
157 | sum_d.OutputName = {'a_z_d'};
158 | sum_d.InputName = {'d'};
159 |
160 | sum_u = sumblk('u = q_s_c');
161 | sum_u.OutputName = {'q_s_c'};
162 | sum_u.InputName = {'u'};
163 |
164 | %Gain Matrices
165 | K_z = tunableGain('K_z',2,2);
166 | K_z.Gain.Value = eye(2);
167 | K_z.InputName = {'a_z_tmd','a_z_d'};
168 | K_z.OutputName = {'z_1_tild','z_2_tild'};
169 |
170 | K_v = tunableGain('K_v',2,2);
171 | K_v.Gain.Value = eye(2);
172 | K_v.InputName = {'a_z_m_d','a_z_c'};
173 | K_v.OutputName = {'v_1','v_2'};
174 |
175 |
176 | %% Compute orange box transfer function
177 | P_s_tild= connect(T_outter,T_r_m,K_z,K_v,Sum_a_in,Sum_a_rm,sum_d,sum_r,sum_u,{'r','d','u'},{'z_1_tild','z_2_tild','v_1','v_2'});
178 |
179 | %% Compute orange + Green box transfer function
180 |
181 | %Weight Matrices
182 | % Component 1
183 | Tf_ws_1 = tf(W1);
184 | Tf_ws_1.InputName='z_1_tild';
185 | Tf_ws_1.OutputName='z_1';
186 | % Component 2
187 | Tf_ws_2 = tf(W2);
188 | Tf_ws_2.InputName='z_2_tild';
189 | Tf_ws_2.OutputName='z_2';
190 |
191 | % Connceted system
192 | P_s= connect(P_s_tild,Tf_ws_1,Tf_ws_2,{'r','d','u'},{'z_1','z_2','v_1','v_2'});
193 |
194 | %% Create Augmented Plant for H-Infinity Synthesis
195 | % P = augw(P_s_tild,W1,W2);
196 | %total number of controller inputs
197 | NMEAS=2;
198 | % total number of controller outputs
199 | NCON=1;
200 |
201 | %hinfstruct
202 | [K_F0,CL,GAM] = hinfsyn(P_s,NMEAS,NCON);
203 |
204 | % obtaining the decomposed control system gains
205 | K_dr=K_F0(1);
206 | K_cf=K_F0(2);
207 |
208 | % minimal control orders
209 | K_dr=tf(minreal(K_dr));
210 | K_cf=tf(minreal(K_cf));
211 |
212 | % obtain converted controllers
213 | Kprime_cf=K_cf/K_dr;
214 | Kprime_dr=K_dr;
215 |
216 | %% Controller analysis
217 |
218 | % order of the controller
219 | order(Kprime_cf);
220 | order(Kprime_dr);
221 |
222 |
223 | % poles and zeros of the controller
224 | figure
225 | iopzplot(Kprime_cf);
226 | figure
227 | iopzplot(Kprime_dr);
228 |
229 |
230 | % frequency behaviour of the controllers
231 | figure
232 | bode(Kprime_cf);
233 | figure
234 | bode(Kprime_dr);
235 |
236 | %% Controller Reduction
237 | Kprime_cf_red =reduce(Kprime_cf,3);
238 | Kprime_dr_red =reduce(Kprime_dr,3);
239 |
240 |
241 | %% Controller analysis
242 |
243 | % order of the controller
244 | order(Kprime_cf_red);
245 | order(Kprime_dr_red);
246 |
247 |
248 | % poles and zeros of the controller
249 | figure
250 | iopzplot(Kprime_cf_red);
251 | figure
252 | iopzplot(Kprime_dr_red);
253 |
254 |
255 | % frequency behaviour of the controllers
256 | figure
257 | bode(Kprime_cf_red);
258 | figure
259 | bode(Kprime_dr_red);
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
--------------------------------------------------------------------------------
/Untitled.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/Untitled.mat
--------------------------------------------------------------------------------
/img/inner_step.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/img/inner_step.JPG
--------------------------------------------------------------------------------
/img/inner_step_unc.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
656 |
--------------------------------------------------------------------------------
/img/inner_step_updated.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/img/inner_step_updated.JPG
--------------------------------------------------------------------------------
/img/missile.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/img/missile.JPG
--------------------------------------------------------------------------------
/slprj/sim/varcache/Main_Simulink/checksumOfCache.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JohannesAutenrieb/RobustMissileControl/911e2f879c76ffbae93b173fb2f56d1138ea3c3f/slprj/sim/varcache/Main_Simulink/checksumOfCache.mat
--------------------------------------------------------------------------------
/slprj/sim/varcache/Main_Simulink/tmwinternal/simulink_cache.xml:
--------------------------------------------------------------------------------
1 |
2 |