Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Linearization of Model
- Cf = 0.5, Ca = 1500, m = 1500
- spd = 60
- Ve = spd*0.44704
- A = [-2*(Cf*Ve)/m]
- B = [Ca/m]
- C = [1]
- D = [0]
- Pss = ss(A, B, C, D)
- Ptf = tf(Pss)
- % step(Ptf)
- % --- Simulink model setup ---
- %Q3-5
- sim_spd = 60
- sim_spd_throttle = 60
- x_e = sim_spd*0.44704
- x_throttle = sim_spd_throttle*0.44704
- u_e = (Cf/Ca)*(x_e^2)
- u_throttle = (Cf/Ca)*(x_throttle^2)
- % --- PID Controller Design
- w_c = 2/1.5
- w_c_d = w_c*180/pi
- PM = 60
- P = Ptf
- [M_p, Ph_p] = bode(P, w_c)
- z = (w_c)/(tand(PM-90-Ph_p))
- K = (w_c)/(sqrt( (w_c^2) + (z^2) ) * M_p)
- K_p = K
- K_i = K_p*z
- C = tf([K K*z], [1 0])
- L = C*P
- PID_cont = pid(K_p, K_i)
Advertisement
Add Comment
Please, Sign In to add comment