%
%   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
%
%
%

%   3-D vector plot

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