
function plotfunc(fun,a,b)

% this m file plots function f(x)
% called fun
% on given interval [a,b]
% in matlab prompt: enter plotfunc('name of func',a,b)


n=2^6;      %this is the step size
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');







