barbs

Plots vector fields and vector time series.
2,6K Downloads
Aktualisiert 15 Dez 2005

Keine Lizenz

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

Zitieren als

Alex Sanchez (2024). barbs (https://www.mathworks.com/matlabcentral/fileexchange/8572-barbs), MATLAB Central File Exchange. Abgerufen .

Kompatibilität der MATLAB-Version
Erstellt mit R14
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

more efficient