function s = myexp(x,N)

%This function evaluates the Taylor polynomial of degree N for the
%exponential function.



%Initialize s by creating a matrix of the same size as x. 

s=zeros(size(x));

%Note that we use .* and ./ for the arithmetic operations. These
%operators are defined for vectors and matrices as well as numbers. The
%operation a.*b If a and b are both m x n matrices, then c = a.*b
%assigns to c the matrix whose entries c(i,j) are given by c(i,j) =
%a(i,j) * b(i,j).

%The addition statement also needs some explanation. If a is a matrix,
%then a+1 is the matrix obtained by adding 1 to every entry of a. 

%Issue the commands
%help plus 
%help times
%at a matlab prompt to read more about these operators. 

for i = 1:(N+1)

s= x.*s./(N+2-i) + 1; 

end 
 


