plotting a graph of time vs gear...updated
Show older comments
based on V=1.5*t^2
a car has an auto-transmission that selects gear based on speed values.
Gear1: >=0 and < 3m/s
Gear2: >=3 and < 8 m/s
Gear3:>=8 and < 15 m/s
and so on...need to graph this and not sure where to start. Thank you
here's what I have...The first graph works perfect...its the second one im stuck on...thanks
t=1:1:6;
V=1.5*t.^2;
plot(t,V)
grid on % adds grid lines
xlabel('Time(s)') % adds x label
ylabel('Speed(m/s)') % ADDS Y LABEL
title('Speed of a Car') % adds Title
t=1:.1:6;
V=(1.5)*t.^2;
if (V>= 0 & V < 3)
Gear=1;
elseif (V>=3 & V < 8)
Gear=2;
elseif (V>= 8 & V < 15)
Gear=3;
elseif (V>= 15 & V< 25)
Gear=4;
else
Gear=5;
end
figure % opens 2nd graph
plot(t,Gear)
grid on
xlabel('Time(s)')
ylabel('Gear')
title('Gear Selection')
1 Comment
Azzi Abdelmalek
on 13 Feb 2014
This is not clear
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!