Filter löschen
Filter löschen

Subplotting error with velocity vs time graph

1 Ansicht (letzte 30 Tage)
jack knipler
jack knipler am 23 Mai 2016
Bearbeitet: dpb am 23 Mai 2016
Hi i am having trouble with plotting a graph for velocity vs time. We have to change the velocity from m/s to km/h and the time from seconds to hours. For some reason when we plot them, they are both straight lines along the x axis. This is our code:
subplot(2,2,3)
t=data(:,1);
thour=t/3600
dkm=displacement/1000
vel=dkm/thour;
plot(thour,vel);
title('Velocity Vs Time:')
ylabel('Velocity (km/h)')
xlabel('Time (h)')

Akzeptierte Antwort

dpb
dpb am 23 Mai 2016
vel=dkm./thour;
Need the dot operator here...
  1 Kommentar
dpb
dpb am 23 Mai 2016
Bearbeitet: dpb am 23 Mai 2016
That's indeterminate from the info available...but I suspect your formulation of dividing by the time vector may be be the culprit. You probably actually need a constant dt for the base conversion. Dividing by an increasingly smaller t at the origin will eventually lead to 1/0-->Inf which it appears is what you have in the plot.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by