%-----------------------------------------------------------------------
  function y = MyExp2(x)
% y = MyExp2(x)
% x is a p-vector, n is a positive integer
% and y is a p-vector of the same shape as x and with the property 
% that y(i) = nTerms-th order Taylor 
% approximation to exp(x(i)) for i = 1:p
% p = size(x)
nTerms = 17;
y    = ones(size(x));
term = ones(size(x));
for k = 1:nTerms
   term = x.*term/k;
   y    = y +term;
end
