
% THE INTENTION OF THIS PROGRAM IS TO SHOW SEVERAL ASPECTS ABOUT GRAPHING
% POINTS AND SEGMENTS IN BETWEEN.
% AFTER EACH DISPLAY  PRESS "ENTER" TO SEE THE NEXT DISPLAY.
  
  % Here, we are graphing several points (just the points) previously defined in the 
  % same xy-plane.
  clc;
  close all;
  clear all;
  %Points are in vector form
  N=5;
  x=[1,1.5,2,2.5,3];
  y=[4,3,-5,0,10];
  
  figure;
  for i=1:N
       plot(x(i),y(i),'*r');
       hold on;
  end
  pause;

  %***********************************************************************  
  % Here, we are graphing linear interpolating segments between several 
  % points previously defined in the same xy-plane.  
  clc;
  close all;
  clear all;
  %Points are in vector form
  N=5;
  x=[1,1.5,2,2.5,3];
  y=[4,3,-5,0,10];
  
  plot(x,y);
  pause;

  %************************************************************************
  % Now, we want the interpolation points to be marked by a colored
  % asterisk and also the segments between the interpolating points
  clc;
  close all;
  clear all;
  %Points are in vector form
  N=5;
  x=[1,1.5,2,2.5,3];
  y=[4,3,-5,0,10];
  
  plot(x,y);
  hold on;
  for i=1:N
        plot(x(i),y(i),'*r');
        hold on;
  end
  pause;
  
  %Now, we want the line segments between consecutive points to be of
  %different color.
  clc;
  close all;
  clear all;
  %Points are in vector form
  N=5;
  x=[1,1.5,2,2.5,3];
  y=[4,3,-5,0,10];
      xg(1)=x(1);
      yg(1)=y(1);
      xg(2)=x(2);
      yg(2)=y(2);
      xr(1)=x(2);
      yr(1)=y(2);
      xr(2)=x(3);
      yr(2)=y(3);
      xm(1)=x(3);
      ym(1)=y(3);
      xm(2)=x(4);
      ym(2)=y(4); 
      xy(1)=x(4);
      yy(1)=y(4);
      xy(2)=x(5);
      yy(2)=y(5);  
      plot(xg,yg,'-g');
      hold on;
      plot(xr,yr, '-r');
      plot(xm,ym, '-m');
      plot(xy,yy, '-y');

 
 