% IAP2007 Introduction to MATLAB: Graphics and Visualization
% Instructor: Violeta Ivanova, violeta@mit.edu

% EXAMPLE 3 Animation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% A. COMPUTE CURVE THROUGH POINTS

% Compute cubic curve through points with (X,Y) coordinates (2, 75), (3, 86), 
% (5, 82), (6, 70), and (8, 40), along interval x from 0 to 10 with step 0.1.
% Hint: create vectors X and Y, then use functions POLYFIT and POLYVAL.

clear all
X = [2 3 5 6 8]'
Y = [75 86 82 70 40]'
C = polyfit(X, Y, 3)
x = [0 : 0.1 : 10];
y = polyval(C, x);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% B. CREATE ANIMATION

% B1. Create a figure window



% B2. Plot the five points.




% B3. Add an animated plot of the cucic drawn point after point (use different color). 
% Hint: Use functions PLOT, SET, HOLD ON and DRAWNOW inside a FOR loop. 
% Set x-axis limits from 0 to 10, and y-axis limit from 0 to 100.



    

 
   


   
 
  
   



