%
%   Book: MATLAB-Based Electromagnetics (Pearson Prentice Hall)
%   Author: Branislav M. Notaros
%   Instructor Resources
%   (c) 2011
%
%   This MATLAB code or any part of it may be used only for 
%   educational purposes associated with the book
%
%
%

%     2-D vector plot

function vecPlot2D(Vi,Vf,scaling,color,origin)
u = Vf(1)- Vi(1);
v = Vf(2)- Vi(2);
x = Vi(1);
y = Vi(2);
if (origin~=0)
   plot(x,y,'o','MarkerSize',10,'MarkerFaceColor',color);
   hold on;
end;
quiver(x,y,u,v,scaling,'LineWidth',2,'Color',color); 
whitebg('white');
grid on;
hold off;
axis equal;