have to use plot3

1 Ansicht (letzte 30 Tage)
Veera Kanmani
Veera Kanmani am 14 Mär. 2018
Bearbeitet: Walter Roberson am 15 Mär. 2018
i have 3 coordinates x,y,z.. i have to plot it using plot3. my x,y,z coordinates gets updated in a for loop. i want all the points to get plotted in one plot using the default line style 'Solid line'. but ican't get it.i can only able to get using other line styles like 'o' , '.'.. Can anyone please help me with it???

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 14 Mär. 2018
You cannot plot with solid line style if you only plot one point at a time.
You should save your data in vectors and plot3() the entire vector after the loop.
If you need the line to update during the run for animation purposes, then have a look at animatedline()
  6 Kommentare
Veera Kanmani
Veera Kanmani am 15 Mär. 2018
Bearbeitet: Walter Roberson am 15 Mär. 2018
my x, y,z is not a function of z.. my x,y,z are the three different coordinates of an object. for example:
x=10;y=8;z=13;
then gets updated after some time (for every t=1:10) randomly...Now i have to plot these and connect all these points after time t.
Walter Roberson
Walter Roberson am 15 Mär. 2018
Bearbeitet: Walter Roberson am 15 Mär. 2018
x = 0; y = 0; z = 0;
h = animatedline(x, y, z);
view(3)
for K = 1 : 100
x = x + randi([-1 1]);
y = y + randi([-1 2]);
z = z + randi([-2 1]);
addpoints(h, x, y, z);
drawnow();
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Animation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by