% query function from Daniel Kennedy
% returns the value of mystery functions 

function f = query_function(x)
   code='test';   % change this to your code
   
   
   % Change func to be whichever function you want to use
   % test1, test2, test3, test4, test5 are test functions
   % actual1, actual2, actual3 are the actual functions for
   % the project

   func='test1';  
   
   %determine the URL to be read
   x=num2str(x,'%.15f');
    str=sprintf('http://math.umn.edu/~nykamp/cgi-bin/finalf.cgi?x=%s&code=%s&function=%s',x,code,func);
      %read and parse all data from the URL
   f=urlread(str);
   str=strcat('f(',x,')=');
   index=findstr(f,str);
   f=f(index+4+length(x):end);
   str='<br>';
   index=findstr(f,str);
   f=f(1:index-1);
   f=str2num(f);
end 
