compute the 2 dimensional (x,y) with respect to time
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
jarvan
le 26 Oct 2014
Réponse apportée : Roger Stafford
le 26 Oct 2014
I have those numbers that is 0 50 0 1 50 -9.8 2 50 -19.6 3 50 -29.4 4 50 -39.2 5 50 -49.0
Which I saved to a.dat file.
Then I have to write a script to read a.dat data from this file into a martix. first column is time , second is x and third is y. Now it have to compute the 2 dimensional (x,y) with respect to time. So far I got : load a.dat time = a(:,1); x = a(:,2);y = a(:,3) plot (time,x,y,'r--')
but it said Error in mysricpt(line 4) plot (time,x,y,'r--')
How should I correct my code?thanks
0 commentaires
Réponse acceptée
Roger Stafford
le 26 Oct 2014
Let 'a' be the given vector.
plot3(a(1:3:end),a(2:3:end),a(3:3:end),'r-')
0 commentaires
Plus de réponses (1)
Youssef Khmou
le 26 Oct 2014
As long as there are three variables, you need to use :
plot3(t,x,y); %.....
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!