% Simulasi model pasif, aktif LQR, dan aktif SMC close all clear all ti = 0 ; tf = 8 ; [TP,YP]=ode45(@mypasif2, [ti tf],[0;0;0;0]); [TL,YL]=ode45(@mylqr3, [ti tf],[0;0;0;0]); [TG,YG]=ode45(@mysmc2, [ti tf],[0;0;0;0;0]); figure(1); plot(TP,YP(:,1),'-',TL,YL(:,1),'--',TG,YG(:,1),':'); title('Travel Suspensi'); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('travel (m)'); grid on; figure(2); plot(TP,YP(:,2),'-',TL,YL(:,2),'--',TG,YG(:,2),':'); title('Kecepatan Getar Badan Mobil'); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('kecepatan (m/s)'); grid on; figure(3); plot(TP,YP(:,3),'-',TL,YL(:,3),'--',TG,YG(:,3),':'); title('Defleksi Roda'); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('defleksi (m)'); grid on; figure(4); plot(TP,YP(:,4),'-',TL,YL(:,4),'--',TG,YG(:,4),':'); title('Kecepatan Getar Roda'); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('kecepatan (m/s)'); grid on; figure(5); plot(TG,YG(:,5)); title('Fungsi Peralihan'); xlabel('waktu (s)'); ylabel('nilai switching'); grid on; figure(6); plot(TP,[0;300*diff(YP(:,2))],'-',TL,[0;300*diff(YL(:,2))],'--',TG,[0;300*diff(YG(:,2))],':'); title('Percepatan Getar Badan Mobil '); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('percepatan (m/s^2)') grid on; figure(7); plot(TP,[0;diff(YP(:,4))],'-',TL,[0;diff(YL(:,4))],'--',TG,[0;diff(YG(:,4))],':'); title('Percepatan Getar Roda Mobil'); legend('pasif','LQR','SMC'); xlabel('waktu (s)'); ylabel('percepatan (m/s^2)')