plotting a graph of time vs gear...updated
Mostrar comentarios más antiguos
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 comentario
Azzi Abdelmalek
el 13 de Feb. de 2014
This is not clear
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!