function finish_time = evaluate_car(differential_ratio) %EVALUATE_CAR determine the time to finish a 1/4-mile drag race % FINISH_TIME = EVALUATE_CAR(DIFFERENTIAL_RATIO) implements a simulation % of 1/4-mile drag race for a Ford Taurus equipped with a differential % with gear ratio equal to DIFFERENTIAL_RATIO. % % Inputs: % DIFFERENTIAL_RATIO: The gear ratio of the differential % [dimensionless] % % Outputs: % FINISH_TIME: Time time finish the race in [s] % % Assumptions: % - The transmission and differential are loss-free % - The load consists only of air and tire resistance % - The car is driven at full throttle % - A torque converter is included in the model % - the tires don't slip % %% ME 2016 %% Fall 2007 %% %% AUTHOR: Chris Paredis %% % the final time is larger than it needs to be -- the simulation will stop % when the car reaches the finish line time_interval = [0, 100]; initial_condition = [0;0]; % make sure the races ends when the finish line is reached options = odeset('Events',@end_of_race_event); %% %% solve the problem %% % solve the car simulation using the Matlab solver ode45 ode_fun = @(t,y)(car_model_w_parameters(t,y,differential_ratio)); [t,y] = ode45(ode_fun,time_interval,initial_condition,options); finish_time = t(end);