Code covered by the BSD License  

Highlights from
vfield

Be the first to rate this file! 6 Downloads (last 30 days) File Size: 2.25 KB File ID: #8652
image thumbnail

vfield

by M MA

 

05 Oct 2005 (Updated 06 Oct 2005)

Plot 2D velocity field.

| Watch this File

File Information
Description

Syntax:
   HANDLE = VFIELD(X,Y,U,V,VARARGIN)

Inputs:
  X, Y Arrows origin, N-D arrays
  U, V Current components, N-D arrays
VARARGIN:
  C, patches CData
 'color', <color> line/patch color [ 'k' ]
'fill', [ {0} | 1 ], fill arrows tip
'tr', <val>, tip length with respect to intensity or absolute length if is a string [ <value> <value as string> {0.1} ]
'fi', <deg>, tip angle [ 30 ]
'z', <val>, z level, value or array size x, y, u and v [ 0 ]

The screenshot was created with:

[x,y] = meshgrid(-2:.2:2,-1:.15:1);
z = x .* exp(-x.^2 - y.^2);
[u,v] = gradient(z,.2,.15);
vfield(x,y,.3*u,.3*v,z), colorbar
axis equal

Acknowledgements
This submission has inspired the following:
vfield_color
MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
06 Oct 2005 Duane Hanselman

How is this an improvement over MATLAB's quiver function?

06 Oct 2005 M MA

The major improvement is the possibility of create the arrows as patches, not as lines, so that you can use the arrows to also show the vorticity field, or temperature, ... or simply the currents speed, as in the screenshot.
Moreover, you can also control the arrowhead scale or length.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
specialized M MA 22 Oct 2008 08:02:03
plotting M MA 22 Oct 2008 08:02:03
arrows M MA 22 Oct 2008 08:02:03
currents M MA 22 Oct 2008 08:02:04
velocity M MA 22 Oct 2008 08:02:04
2d M MA 22 Oct 2008 08:02:04
plot M MA 22 Oct 2008 08:02:04

Contact us at files@mathworks.com