
function plotfun(fun,a,b)

% this m file plots function f(x)
% on given interval [a,b]
% using n points
% at the matlab matlab prompt: enter plotfun('name of fun',a,b)


n=2^5;  %this is the step size which deterimes the number of points to plot
dx=(b-a)/n;


for i=1:n
 x(i)=a + dx*i;
 y(i)=feval(fun,x(i)); %evaluate fun at x
end


plot(x,y); 
title('Plot of f(x)');
xlabel('x');
ylabel('y');







