Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Matlab, The acceleration of a car is given by the following formula that i

ID: 3687157 • Letter: U

Question

Using Matlab,

The acceleration of a car is given by the following formula that includes an acceleration term A due to the engine torque and an air drag term that is proportional to the square of the velocity: dv/dt = A-C middot v^2 It is desired to measure the 0-60 mph performance of the car, as well as its braking performance from 60-0 mph. To this end, the driver first applies maximnm torque until the car reaches 60 mph and measures the cufrcs|iondiug time, say, t_60, and then, she applies the brakes until the car stops, and measures the stopping time, t_stop. Let us discretize the time as, t_n = (n - 1)T, where n = 1, 2, 3,...,and T = 0.001 sec is a small time step. Then, the above differential equation may be replaced by the following difference equation: u(n + 1) = v(n) + T middot [A(n) - C middot v^2(n)] (3) where v(n) is iu units of mph. the drag constant is chosen as C = 0.008, and the initial acceleration and sulsequent braking action can be modeled by: A(n) = {30, if t_n lessthanorequalto t_theta0 -2, if t_60

Explanation / Answer

Answer:)

Code:

go = true;
n = 1;
T=.001;
t60 = (60-1)*T;
vn_arr = [];
tn_arr = [];
vn = 0;
C = 0.008;
% Part (a) is in this section
while go
tn = (n-1)*T;
tn_arr{n} = tn;
if tn <= t60
An = 30;
else
An = -2;
end
vn_arr{n} = vn;
n = n+1;
vn = vn + T*(An - (C*vn*vn));
if vn >= 60
go = false;
end
end

% Part (b) is in this section
go = true;
while go
tn = (n-1)*T;
tn_arr{n} = tn;
if tn <= t60
An = 30;
else
An = -2;
end
vn_arr{n} = vn;
n = n+1;
vn = vn + T*(An - (C*vn*vn));
if vn == 0
go = false;
end
end
  
tn_arr=tn_arr';
vn_arr=vn_arr';

plot(tn_arr,vn_arr)
xlabel('t(n)')
ylabel('v(n)')

Note: I did this code in online matlab simulator. It was giving me "out of time". Please run it in matlab software and let me know if you are getting the plot or not.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote