No BSD License  

Highlights from
Colored 2D Vector Field Plotter

1.0

1.0 | 1 rating Rate this file 5 Downloads (last 30 days) File Size: 2.63 KB File ID: #17754
image thumbnail

Colored 2D Vector Field Plotter

by Michael Sullivan

 

26 Nov 2007 (Updated 27 Nov 2007)

Plots 2D vectors colored according to their lengths.

| Watch this File

File Information
Description

COLORVFIELD Colored 2D Vector Field Plotter.

COLORVFIELD(X,Y,U,V) plots colored vectors with components (u,v) at the points (x,y). The vectors are colored using the jet color map (with the smallest vectors colored blue the largest colored red) and are divided into 32 discrete color levels.

COLORVFIELD(X,Y,U,V,NUMBER_COLOR_LEVELS) divides the color map into NUMBER_COLOR_LEVELS dicrete color levels.

Example:
X = linspace(-10,10,32);
Y = linspace(0, 0, 32);
U = linspace(-1,-5,32);
V=linspace(1,5,32);
colorvfield(X,Y,U,V,16); % plot 16 color levels
title('Vectors Plotted with Color Map (colorvfield.m)')
axis([-12.25,11.75,-0.25,4.75])
xlabel('X')
ylabel('Y')

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
colorvfield, field, jet, plotting, quiver, specialized, vector
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
28 Nov 2007 Michael Sullivan

Hi all,

First, I know that the .m file will not work with Matlab v6 or before. I'm not sure the other version restrictions, but I know it works for me in R2007a.

M Tg, thank you for your input, but there are some differences between this project and vfield. Vfield plots a three dimensional vector field in two dimensions, with the color scheme being applied relative to direction. This project is simpler, plotting a 2D vector field in 2D, with colors being applied relative to the magnitudes of the vectors.

I posted the project because I had a need for something similar, and hopefully the code is easy to understand and modify. I'd be happy to help anybody get it working (though there are some known version restrictions with colored quiver vectors).

Mike

28 Nov 2007 A Zhu

Either I or my Matlab is a dummy, whatever, there is no right results there. While I follow the vfield.m, perfect color picture I got.

27 Nov 2007 M Tg

This is nice, but there is already such utility.
Search in FEX for vfield (also vfield3)

Contact us