'PERANCANGAN PENGENDALI PENDULUM TERBALIK'
%
'PARAMETER-PARAMETER FISIK (silakan di-modifikasi)'
g=10 % gravitasi [m/sec2]
l=0.5 % panjang pendulum [m]
M=0.25 % Massa Kereta [kg]
m=0.05 % massa bob pendulum [kg]
pause
%
'HASIL LINIERISASI lihat files:' 
'(1) Perancangan_Pendulum_Terbalik_hal-1.pdf'
'(2) Perancangan_Pendulum_Terbalik_hal-2.pdf'
% 
pause
A = [0 1 0 0; 0 0 -(m*g)/M 0; 0 0 0 1; 0 0 (M+m)*g/(M*l) 0] 
pause
B = [0; 1/M; 0; -1/(M*l)]
pause
%
'Check Kestabilan:'
nilai_eigen_A = eig(A)
pause
'Penempatan nilai eigen [A - BK], silakan pilih sendiri lambda'
j = sqrt(-1)
lambda = [-10+0.001;-10-0.001;-10+(j*0.001);-10-(j*0.001)]
pause
'Mencari Gain Matrix K'
K = place(A,B,lambda)
pause
'Periksa nilai eigen [A - BK]'
new_lambda = eig(A - (B*K))
'SELESAI'
