function [] = eero2(vec, col, lW )
%This function plots a 2D vector as an arrow
%It is a takeoff on the eero function, but it sets defaults arguments
%and checks the inputs. We use it to introduce these concepts
%Who?
%When?
nargin; %nargin returns the number of input arguments to a function 

%If the number is 3, simply use what the user gave you. If it is less, we
%need to set defaults, otherwise we will encounter an error
if nargin == 2 %If it less than 3, specifically, if it is 2
    lW = 3; %That is our default
elseif nargin == 1 %If the last 2 are missing
    col = 'g' %Nice default color
    lW = 3; %Same
end

%If executes everything between if and end (if and only if the conditional
%is met), it tries each instance consecutively, then exits the statement. 
%There is one end that closes the if. In between, everything between if and
%elseif or elseif and elseif or elseif and else is executed. 

if lW > 5
    disp ('Your arrow is too fat. We fixed that for you.')
    lW = 5;
end %No else


quiver(0,0,vec(1),vec(2),0,'color',col,'LineWidth',lW); %Plots a vector as an arrow
%in color col, with width lW

end

