function vecPlot(a, color)
% vecPlot - plot a vector in R2
%   
% 
%   Syntax: 
%           vecPlot(a)
%   Arguments: 
%           a     - the vector to plot, must be in R2
%           color - optional color argument
%   Returns: 
%           
%           
%   Description:
%
%           Plot the vector a as a line  in the current figure.
%           If the vector is not in R2 an error message is displayed.
%           color is an optional argument to assign a specific
%           color or linestyle to the plot in the same way as
%           matlab's plot function
%   See also:
%

%----------------------------------------------------------------------
%   Bugs:
%
%   Date created: 
%          990910
%   Author:
%          Marten Levenstam
%
%   Change history:
%
%                              +---------------------------------------+ 
%                              |     Matematik Kf/Kb 1999-2000         | 
%                              |     Copyright (c) 1999                | 
%                              |                                       | 
%                              |     Marten Levenstam                  | 
%                              |     Klas Samuelsson                   | 
%                              |     Dep. of Mathematics               | 
%                              |     Chalmers University of Technology | 
%                              |     S-412 96 Gothenburg               | 
%                              |     SWEDEN                            |     
%                              |     martenl@math.chalmers.se          |     
%                              |                                       |     
%------------------------------+---------------------------------------+
if vecIsInR2(a)
   if nargin == 1
     plot([0 a(1)], [0 a(2)]);
   else
     plot([0 a(1)], [0 a(2)], color);
   end
else
  error('vecPlot: a is not in R2');
end

grid on

