No BSD License  

Highlights from
barbs

4.0

4.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 11.94 KB File ID: #8572
image thumbnail

barbs

by alex sanchez

 

27 Sep 2005 (Updated 15 Dec 2005)

Plots vector fields and vector time series.

| Watch this File

File Information
Description

Plots vector fields and vector time series

DESCRIPTION:
Plots barbs or arrows conserving angles and can place a scaling bar.The positions of the components u and v can be entered as matrices or vectors as with quiver.m The x axes can be labels of datestr.m A scaling factor (dar) is used between the x axes and y axes to conserve the angles and another scaling factor (ra) is used for the length of the barbs ir arrows.

INPUT VARIABLES:

% u,v = Vector Componentes
% t,p = Positions of the vectors u,v
% t is usually a time series but can also be x coordinates
% p is usually vertical coordinates
% ft = datestr.m format for labeling the the x axes
% dar = Scaling factor between x and y axes
% This is set as the second element of the property 'DataAspectRatio'
% ra = Length scaling factor for the barbs or arrows
% s = Type of line or 'LineStyle'
% lim = Limits for the axes in the form [xmin,xmax] or
% [xmin,xmax,ymin,ymax]
% rv = Magnitude of the scaling bar
% units = Units of the barbs as a string
% dx,dy = Normalized position of the scaling bar
%
% OUTPUT VARIABLES:
% L = Vector of handles of the lines, L(end) is the handle of the
% scaling bar if it exist
%
% DEFAULT INPUT VARIABLES:
% The default values change depending on the input format
% t = 1:length(u), dar = 1, ra = 1, s = 'b', ft=6, y p=0:10:10*size(u,2)
% rv y units are omitded if values are not given
%
% VALID INPUT FORMATS:
% Number of | Posible
% Arguments | Formats
%--------------------------------------------------------------------------
% <2 | Runs the barbs demo
% 2 | (u,v)
% 3 | (u,v,dar)
% 4 | (u,v,t,p), (u,v,t,ft), (u,v,dar,ra)
% 5 | (u,v,t,p,ft), (u,v,t,ft,dar), (u,v,t,ft,s), (u,v,dar,ra,s)
% 6 | (u,v,t,p,ft,dar), (u,v,t,ft,dar,ra), (u,v,t,ft,dar,s), (u,v,dar,ra,s,lim)
% 7 | (u,v,t,p,ft,dar,ra), (u,v,t,ft,dar,ra,s), (u,v,t,ft,dar,ra,rv)
% | (u,v,t,ft,dar,ra,lim)
% 8 | (u,v,t,p,ft,dar,ra,s), (u,v,t,ft,dar,ra,s,lim), (u,v,dar,ra,s,lim,rv,units)
% | (u,v,t,ft,dar,ra,rv,units)
% 9 | (u,v,t,p,ft,dar,ra,s,lim), (u,v,t,ft,dar,ra,s,lim,rv)
% 10 | (u,v,t,p,ft,dar,ra,s,lim,rv), (u,v,t,ft,dar,ra,s,lim,rv,units)
% | (u,v,dar,ra,s,lim,rv,units,dx,dy)
% 11 | (u,v,t,p,ft,dar,ra,s,lim,rv,units),
% 12 | (u,v,t,ft,dar,ra,s,lim,rv,units,dx,dy)
% 13 | (u,v,t,p,ft,dar,ra,s,lim,rv,units,dx,dy)
%

Notes:
If u and v are vectors, it does not matter if they are column vectors or row vectors.If u, v, t and p are matrices, the variables should be used as if using quiver.m.If u and v are matrices and t and p are vectors, u and v are separated in length(t) rows amd length(p) columns.

For example if t and p are set as:

       t=-2:.2:2; p=-1:.15:1;
   this is equivalent to using:
       [t,p] = meshgrid(t,p);

but u and v must correspond in dimensions to t and p as if using quiver.m (see Examples 5 and 6 in demo). If datestr.m labels are not wanted ft can be set as []. If any marker is used for the 'LineStyle', arrows are drawn instead of barbs (lines). At the end of the program is a demo which can be reviewed for further details. The demo is run by executing the program with <2 input variables.

Comments:
The section where the input variables are read could be made more efficient by using a switch for every number of arguments and then using if's to determine the proper format but I'm to lazy to change it because the program works fine the way it is. If someone is up to it be my guest. The only reason I opted to use try's is because it was faster for me to program because in a sense I programed all formats at once.

Oh, and sorry the comments are in spanish...

Copy-Left, Alejandro Sánchez-Barba, 2005

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
07 Sep 2006 Jacob Royle

This is really easy to use, it does what it says it does, and it saved me a few hours studying the manual. So thats great!.

Please login to add a comment or rating.
Updates
15 Dec 2005

more efficient

Tag Activity for this File
Tag Applied By Date/Time
graphics import alex sanchez 22 Oct 2008 08:00:54
graphics export alex sanchez 22 Oct 2008 08:00:54
barbs alex sanchez 22 Oct 2008 08:00:54
feathers alex sanchez 22 Oct 2008 08:00:54
vector plot alex sanchez 22 Oct 2008 08:00:54
utilities alex sanchez 22 Oct 2008 08:00:54
graphics alex sanchez 22 Oct 2008 08:00:54

Contact us at files@mathworks.com