Matlab displays multiple 3D lines

I have n pairs of points:

 (x1,y1,z1) (u1,v1,w1) , (x2,y2,z2) (u2,v2,w2) , .... , (xn,y2,zn) (un,vn,wn) 

I want to build a three-dimensional line for each pair. All lines in one window (plot).

So, I will have only n lines.

How can I do this in matlab?

thanks

+6
source share
1 answer

The answer to the paragraph, of course, is correct. However, you can also build multiple rows with a single call to plot3 if the data is ordered correctly. For your example:

 x = [0 , 3; -1, -5]'; y = [0 , 3; -1, -5]'; z = [0 , 3; -1, -5]'; plot3(x, y, z) 

In particular, plot3 (like plot and line ) creates one row for each column of three (two) inputs.

+8
source

Source: https://habr.com/ru/post/959415/


All Articles