%
%   SINH_SERIES_MAIN.M   Main Program to Evaluate sinh(x) using a 
%                           Taylor Series Expansion
%
%   This main program calls function SINH_SERIES.M to compute the the function, 
%   f(x) = sinh(x), using a Taylor series representation.  It is used to generate
%   some results for use in the Lesson #4 Lecture Notes on evaluating infinte 
%   series expansions..
%  
%   File prepared by J. R. White, UMass-Lowell (last update: Oct. 2017)
%

      clear all,  close all
%
%   evaluate sinh(x) using Taylor series and compare to built-in function
      format short e
      x = linspace(100*eps,5,11);  x = x';
      f = sinh_series(x);
      rerr = (f-sinh(x))./sinh(x);
      disp('       x       f = sinh(x)   rel error'),   [x  f  rerr]
%
%   evaluate sinh(x) at x = 10
      sinh_series(10)
      sinh_series(10,[],0.05)
      sinh_series(10,25)
      sinh(10)
%
%   plot sinh(x) over 0 < x < 2
      clear x f
      x = 0:0.1:2;   f = sinh_series(x);
      plot(x,f,'r-','LineWidth',2),grid
      title('Plot of f(x) = sinh(x) using Taylor Series')
      xlabel('x value'), ylabel('f(x) = sinh(x)')
%
%   end of demo
