%%%% taylor.m, by rha on vaio 06 feb 2004
% cf manual p. 9-18
% demo of the symbolic math toolbox
syms x % define a symbolic variable
f = sin(x);
t = taylor(f,4); % taylor series at x = 0 degree <= 2
xd = -3:0.1:3; yd = subs(f,x,xd);
ezplot(t, [-3,3]); % plot the taylor polynomial
hold on;
plot(xd, yd, 'r-.'); % add plot of sine function
% end: taylor.m