% part 3 of the mini project % Prabir Barooah, March 20, 2009 clear all %conversion: mph2mpersec = 0.44704; %m/sec m = 1300; %kg b = 42926.2; %N/volt a = 150.91; %30.17; % N/m^2 s^2 v_0 = 60*mph2mpersec; theta_0 = a*v_0^2/b %% part 1 %for running simulink model 'car_nonlinear' theta_1 = theta_0; theta_2 = theta_0+0.3; % step time is alraedy specified as 10 sec, % so just run the simulink model: % I use a matlab command 'sim' to run simulink from % matlab script: sim('car_nonlinear'); figure subplot(211); plot(tout,v); set(gca,'fontsize',18); xlabel('t (sec)'); ylabel('v(m/s)'); subplot(212); time =[0 10 10.00001 20]; theta = [theta_1 theta_1 theta_2 theta_2]; plot(time,theta); set(gca,'fontsize',18); xlabel('t (sec)'); ylabel('\theta (Volt)'); %% part 2 p= 2*a*v_0/m k = b/m