help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting Lines in 3D


From: Thomas D. Dean
Subject: Re: Plotting Lines in 3D
Date: Thu, 06 Aug 2015 11:52:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 08/06/15 06:40, Richardson, Anthony wrote:

<snip>

In a separate post I give:

plot3([X(:,1)'; X(:,4)'], [X(:,2)'; X(:,5)'],[X(:,3)'; X(:,6)']);

or (to plot all lines in the same color):

plot3([X(:,1)'; X(:,4)'], [X(:,2)'; X(:,5)'],[X(:,3)'; X(:,6)'],'b');


I was having problems getting my head around the arguments, the content and shape.

From help plot3, the simplest form

     Many different combinations of arguments are possible.  The
     simplest form is

          plot3 (X, Y, Z)

     in which the arguments are taken to be the vertices of the points
     to be plotted in three dimensions.  If all arguments are vectors of
     the same length, then a single continuous line is drawn.  If all
     arguments are matrices, then each column of is treated as a
     separate line.  No attempt is made to transpose the arguments to
     make the number of rows match.

The applicable sentence: If all arguments are matrices, then each column of is treated as a separate line.

octave:815> U=[X(:,1)'; X(:,4)'];
octave:816> V=[X(:,2)'; X(:,5)'];
octave:817> W=[X(:,3)'; X(:,6)'];
octave:818> plot3(U,V,W)

The first column of U,V,W, respectively define the first line.

L1_x1 = U(1,1)
L1_y1 = V(1,1)
L1_z1 = W(1,1)

L1_x2 = U(2,1)
L1_y2 = V(2,1)
L1_z2 = W(2,1)

etc.

My code is less than 30 lines.  Is this a good example for plot3?

Tom Dean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]