3.8

3.8 | 5 ratings Rate this file 169 downloads (last 30 days) File Size: 4 KB File ID: #6066

quiver3d

by Daniel Ennis

 

18 Oct 2004 (Updated 21 Oct 2004)

Code covered by BSD License  

This function provides an improvement over the QUIVER3 technique for visualizing 3D vector fields.

Download Now | Watch this File

File Information
Description

% QUIVER3d *True* 3D quiver plot.
%
% This function provides an improved technique for visualizing 3D
% vector fields. It relies on the efficient use of a single patch
% call and lighting effects to provide depth cueing.
%
% QUIVER3D(X,Y,Z,U,V,W) plots velocity vectors as arrows with components
% (u,v,w) at the points (x,y,z). The matrices X,Y,Z,U,V,W must all be
% the same size and contain the corresponding position and velocity
% components. QUIVER3D automatically scales the arrows to fit.
%
% QUIVER3D(X,Y,Z,U,V,W,COLOR) provides an input argument for coloring
% the vecotors. The COLOR argument can be a single color ([1x3] or
% [3x1]), and indexed color ([1xN] or [Nx1]), or a true color ([3xN or
% Nx3). Where N is equal to the number of elements in X or Y or Z or...
%
% QUIVER3D(X,Y,Z,U,V,W,COLOR,S) automatically
% scales the arrows to fit and then stretches them by S.
% Use S=0 to plot the arrows without the automatic scaling. S=1
% provides simple autoscaling.
%
% QUIVER3D(X,Y,Z,U,V,W,COLOR,S,N) provides an input that defines the
% density of the tessellation used in generating the arrows. If N is
% high (>15) then the rendering time can be long and interactivity of
% the rendering can be slow. If N<15 the rendering is generally quick
% for ~100s of vectors. The default is N=15;
%
% H = QUIVER3D(...) returns a patch object of the arrow cluster.
%
% Example:
% quiver3d; % Generates a sample output of the function.
%
% DBE 10/17/04

MATLAB release MATLAB 7 (R14)
Other requirements Hopefully none! Let me know!
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (11)
20 Oct 2004 Valeri Karlov

function rot3d is missing when run quiver3d example

20 Oct 2004 Daniel Ennis

The rot3d function call should have been commented out. The two lines the precede it were intended to replace it. Another minor modification was also submitted that changes the way the arrow body diameter is scaled.

21 Oct 2004 urs Schwarz (us)

very nice work, Daniel!

01 Feb 2006 Paulo J. Paupitz Goncalves

have you tried something really simple as:
quiver3d(0,0,0,1,0,0)

I got and error.

Regards

02 Feb 2006 Daniel Ennis

I welcom constructive feedback. I am happy to make changes to the function. If you can provide more details I can likely fix the problem, but the example you provide works as expected on my platform.

15 Mar 2006 Andrew Moss

I got an error every time I tried to run this function. Here are some samples I tried. I really didn't have time to go through your code much so I have no idea what it might be, I may even just be using it wrong but I thought I would let you know anyway

>> quiver3d
??? In an assignment A(:,matrix) = B, the number of elements in the subscript of A and the number
of columns in B must be the same.

Error in ==> F:\MATLAB Files\quiver3d.m
On line 115 ==> Evct(:,2)=cross(Evct(:,1),[1 0 0])/norm(cross(Evct(:,1),[1 0 0]));

>> quiver3d(1,1,1,0,0,1)
??? In an assignment A(:,matrix) = B, the number of elements in the subscript of A and the number
of columns in B must be the same.

Error in ==> F:\MATLAB Files\quiver3d.m
On line 115 ==> Evct(:,2)=cross(Evct(:,1),[1 0 0])/norm(cross(Evct(:,1),[1 0 0]));

30 Mar 2006 R Heavy

Couldn't even run the demo mode. Error message reads:

??? Error: File: quiver3d.m Line: 77 Column: 43
Incomplete or misformed expression or statement.

Cursor placed at the end of:
indexed_color=(size(arrow_color,1)==1 &

"amp" does not show up previous to this point.

30 Mar 2006 R Heavy

Something got cut off in the last message:

The cursor was placed at the end of:
...==1 &

30 Mar 2006 R Heavy

Weird, happened again. The characters after the ampersand should be "amp" without the quotes.

25 Sep 2008 avi tzur  
08 Jan 2009 Divahar Jayaraman

Works Great...

Best wishes

Thanks,

Divahar Jayaraman

Please login to add a comment or rating.
Updates
21 Oct 2004

Minor modifications. 1) Eliminated call to rot3d. It should have been commented out. 2) Changed calculation of arrow body diameter to be based on vector magnitude, not position magnitude.

Tag Activity for this File
Tag Applied By Date/Time
specialized Daniel Ennis 22 Oct 2008 07:33:13
plotting Daniel Ennis 22 Oct 2008 07:33:13
quiver quiver3 vector field render plot Daniel Ennis 22 Oct 2008 07:33:13
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com