PlotSlope - Plot line with given slope. USAGE p = PlotSlope(x,y,slope,length,<options>) x,y coordinates of central point slope line slope length segment length along the x axis <options> line and color specification (see <a href="matlab:help plot">plot</a>)
0001 function p = PlotSlope(x,y,slope,len,varargin) 0002 0003 %PlotSlope - Plot line with given slope. 0004 % 0005 % USAGE 0006 % 0007 % p = PlotSlope(x,y,slope,length,<options>) 0008 % 0009 % x,y coordinates of central point 0010 % slope line slope 0011 % length segment length along the x axis 0012 % <options> line and color specification (see <a href="matlab:help plot">plot</a>) 0013 % 0014 0015 % Copyright (C) 2010-2016 by Michaƫl Zugaro 0016 % 0017 % This program is free software; you can redistribute it and/or modify 0018 % it under the terms of the GNU General Public License as published by 0019 % the Free Software Foundation; either version 3 of the License, or 0020 % (at your option) any later version. 0021 0022 if nargin < 4, 0023 error('Incorrect number of parameters (type ''help <a href="matlab:help PlotSlope">PlotSlope</a>'' for details).'); 0024 end 0025 0026 X = x+[-len len]/2; 0027 Y = y+[-len len]/2*slope; 0028 plot(X,Y,varargin{:});