MATLAB: Plotting a graph

plotting

Sorry, this is a very simple question I'm sure but I just can't work it out. I'm trying to plot the error of my function that ascertains e^x for a value of x. However, when I try and plot the vectors containing the relevant information I get a load of errors.
My M-file:
function T = findexp(x,n)
%findexp, function to evaluate e^x
e=zeros(1,n);
T(1)=1;
e(1)=abs(T(1)-exp(x))/x;
for i = 2:n+1
T(i) = T(i-1)+x^(i-1)/(factorial(i-1));
e(i) = abs((T(i)-exp(x))/(x));
if i == n+1
fprintf(1,'T(%d) = %1.15e\n',x,T(i));
end
end
p=1:1:n+1;
y=e(p);
plot(p,y)
However, what I get is the output:
EDU>> findexp(1,25) T(1) = 2.718281828459046e+000 ??? Input argument "n" is undefined.
Error in ==> error at 4 e(i) = abs((findexp(x,n)-exp(x))/x);
Error in ==> clo at 20 error(nargchk(1, 3, nargin));
Error in ==> cla at 29 clo(ax, extra{:});
Error in ==> newplot>ObserveAxesNextPlot at 134 cla(ax, 'reset',hsave);
Error in ==> newplot at 83 ax = ObserveAxesNextPlot(ax, hsave);
Error in ==> findexp at 17 plot(e,p)
What am I doing wrong? Thanks for your help in advance

Best Answer

You defined your own file error.m, conflicting with MATLAB's error() routine.