function [x,U]=my_exp(c,I,ua,h)
% my_exp - approximate solution of u'(x) =cu(x), u(a)=ua.
% 
%   Syntax: 
%           [x,U]=my_exp(c,I,ua,h)
%   Arguments: 
%           c - a real number 
%           I  - 1x2 matrix, specifying an interval I=[a b]
%           ua - a real number, the initial value
%           h - positive number, the stepsize
%   Returns: 
%           x - a vector, the set of nodes x(i)
%           U - a vector, U(i) is an approx of ua*exp(c*x(i))
%   Description:
%           The program computes an approximate solution
%           of the initial value problem 
%           u'(x) =cu(x), a<x<b, 
%           u(a)=ua,
%           using the algorithm in Chapter 31 with stepsize h. 
% 
%   Examples: 
%          [x,U]=my_exp(1,[0 1],1,1e-3) computes exp(x)
%   See also:  exp
%          
%

%----------------------------------------------------------------------
%   Bugs:
%
%   Date created: 
%          
%   Author:
%          
%
%   Change history:
%
%------------------------------+---------------------------------------+
a=I(1);
b=I(2);

i=1;
x(1)=a;
U(1)=ua;

while x(i)<b
  i=i+1;
  x(i)=x(i-1)+h;
  U(i)=U(i-1)+h*c*U(i-1);
end

x=x';
U=U';

