% 22.3MB1 Fall 01
% Yvan Petillot
% Code to visualise a time varying vector (timevarvec)

clear; close all;
 
% Set graphics parameters.
axis([-10 10 -20 20 -30 30]);
hold on;
title('Time-varying Vector: {\bf V} = 10 cos(\omegat) {\bf x} + 20 cos(\omegat + 60^o){\bf y} + 30 cos(\omegat - 60^o){\bf z}');
xlabel('x');
ylabel('y');
zlabel('z');


% Generate the movie.
delt = 0.1;
for k = 1 : 25
    % Coefficients
    t = k*delt;
    V_x=10*cos(pi*t);
    V_y=20*cos(pi*t+pi/3);
    V_z=30*cos(pi*t-pi/3);
    
    cla;
    %plot3([0 V_x],[0 V_y],[0 V_z],'-o');
    quiver3(1,2,3,V_x,V_y,V_z,30);
   
     pause(0.1);
 end;
hold off;