arrow函数的作用是绘制一条带箭头的直线,该函数包括的箭头类型远比MATLAB自带的箭头功能强大。
举例:
arrow([1 2 3],[0 0 0],36,‘BaseAngle’,60)
该函数的直线起点为[1 2 3],终点为[0 0 0],箭头长度占据36个像素,夹角BaseAngle为60度,关于箭头参数的示意如下图所示。
MATLAB部分源码如下:
function [h,yy,zz] = arrow(varargin)
% ARROW Draw a line with an arrowhead.
%
% ARROW(Start,Stop) draws a line with an arrow from Start to Stop (points
% should be vectors of length 2 or 3, or matrices with 2 or 3
% columns), and returns the graphics handle of the arrow(s).
%
% ARROW uses the mouse (click-drag) to create an arrow.
%
% ARROW DEMO & ARROW DEMO2 show 3-D & 2-D demos of the capabilities of ARROW.
%
% ARROW may be called with a normal argument list or a property-based list.
% ARROW(Start,Stop,Length,BaseAngle,TipAngle,Width,Page,CrossDir) is
% the full normal argument list, where all but the Start and Stop
% points are optional. If you need to specify a later argument (e.g.,
% Page) but want default values of earlier ones (e.g., TipAngle),
% pass an empty matrix for the earlier ones (e.g., TipAngle=[]).
%
% ARROW(‘Property1’,PropVal1,‘Property2’,PropVal2,…) creates arrows with the
% given properties, using default values for any unspecified or given as
% ‘default’ or NaN. Some properties used for line and patch objects are
% used in a modified fashion, others are passed directly to LINE, PATCH,
% or SET. For a detailed properties explanation, call ARROW PROPERTIES.
下载完整源代码地址:
http://page2.dfpan.com/fs/6lbc9j72b2515209160/