[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Plotting 3D vectors

**From**: |
Jonathan Stickel |

**Subject**: |
Re: Plotting 3D vectors |

**Date**: |
Wed, 03 Aug 2005 08:43:30 -0700 |

**User-agent**: |
Mozilla Thunderbird 1.0.2 (X11/20050317) |

Gad Abraham wrote:

Hi,
Is it possible to plot vectors in 3D?
I'm trying to visualise some 3D vectors, e.g.:
A = [1;2;3]
B = [5,4,6]
AB = A - B
N = cross(A, B)

`I'd like to put dots at points A and B, and then plot the vector AB with
``an arrow and the normal N with an arrow.
`
Thanks,
Gad

This can be done nicely with Octaviz (octaviz.sourceforge.net):
A = [1;2;3]
B = [5;4;6]
AB = A - B
N = cross(A, B)
X = [A(1);B(1)]
Y = [A(2);B(2)]
Z = [A(3);B(3)]
NX = [AB(1);N(1)]
NY = [AB(2);N(2)]
NZ = [AB(3);N(3)]
vtk_plot3(X,Y,Z,"MarkerSize",0.1);
vtk_arrows3([X(2);X(2)],[Y(2);Y(2)],[Z(2);Z(2)],NX,NY,NZ,"Color",[1,0,0])
I can send you the example plot offlist if you like.
Jonathan
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------