function [value] = hw5afn(x,y,n,z)

   i = 1;
   while x(i+1) < z
      i = i+1;
   end      

   value = y(i)+(y(i+1)-y(i))/(x(i+1)-x(i))*(z-x(i));

end
