Reputation: 827
I've got few points and I wanted to draw them, and join them with line, I tried:
plot3(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4)
and so on up to about 100, but Im just getting plot with many points, how to join them with line?
Upvotes: 1
Views: 19493
Reputation: 1744
There is another possibility which is using the low level function called line
. By taking the above example, your code would look like this:
x=[x1,x2,...,xn];
y=[y1,y2,...,yn];
z=[z1,z2,...,zn];
line(x,y,z);
Upvotes: 0
Reputation: 42225
What you're doing right now is telling MATLAB to plot each point separately. What you should do is to store all your points as a vector and then use plot3
. E.g.,
x=[x1,x2,...,xn];
y=[y1,y2,...,yn];
z=[z1,z2,...,zn];
plot3(x,y,z)
This way you get a line joining your points.
Upvotes: 6