%   EEMAG1 Fall 99
%   S. Mandayam, ECE, Rowan University
%   Code to generate movie of time varying vector (timevarvec)

clear; close all;
 
% Set graphics parameters.
axis([-10 10 -20 20 -30 30]);
hold on

% Generate the movie.
delt = 0.1;
nframes = 24;
M = moviein(nframes);
for k = 1:nframes,
    % 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);
   
    % Capture the frame
    M(:,k) = getframe;
 end;
hold off

% save the movie
save timevecmovie M;
