function demo_diff()
% input a string to specify a function
% plot its derivative
ss=input('function of x:','s');
fx=inline(ss);
x=sym('x');
ss=['diff(' ss ')'];
ss1=char(eval([sprintf(ss)]));
fx1=inline(ss1)
x=linspace(-5,5);
plot(x,fx(x),'b');hold on;
for i=1:length(x)
    y(i)=fx1(x(i));
end
plot(x,y,'r');
return
