In: Mechanical Engineering
Using MATLAB:
The velocity, v, and the distance, d, as a function of time, of a car that accelerates from rest at constant acceleration, a, are given by
= a n d = 12
Determine v and d at every second for the first 10 seconds for a car with acceleration of = 15 ft/s2. Your output must have exactly the same format as the template table below. Note that dots have been added to the table below; you can count the dots to determine the exact spacings. Also note the units.
··········Time (s) ······· ···Distance (ft) ·········Velocity (mph) ··········x.x·················x.xxe+yy···············x.xxx
MATLAB CODE
clear
clc;
a = 15; %ft/s2 (acceleration)
for i = 1:10
t(i) = i; %time span
d(i) = 12 + (1/2)*a*t(i)^2; % initial distane is
12 ft.
v(i) = a*t(i)*(3600/5280); % 1 mile = 5280 ft
and 1h =3600 sec
end
table = [t' d' v']
Ans
Time(s) | Distance(ft) | velocity (mph) |
1.0000 | 19.5000 | 10.2273 |
2.0000 | 42.0000 | 20.4545 |
3.0000 | 79.5000 | 30.6818 |
4.0000 | 132.0000 | 40.9091 |
5.0000 | 199.5000 | 51.1364 |
6.0000 | 282.0000 | 61.3636 |
7.0000 | 379.5000 | 71.5909 |
8.0000 | 492.0000 | 81.8182 |
9.0000 | 619.5000 | 92.0455 |
10.0000 | 762.0000 | 102.2727 |