Taylor series in 1 variable

syms x
T1=taylor(exp(x)) %Maculurian Series
T2=taylor(sin(x))
T3=taylor(log(sin(x)),x,2) % Taylor series at x=2
T4=taylor(log(x),x,1)

Taylor series in 2 variable

syms x y
f = y*exp(x - 1) - x*log(y);
T = taylor (f, [x y], [1 1],'Order',3)
%taylor series in multiple variables
syms x y z
f = sin(x) + cos(y) + exp(z);
T = taylor(f)
%taylor series plot
syms x
f = sin(x);
T6 = taylor (f, x);
T8 = taylor (f, x,'Order',8);
T10 = taylor (f, x,'Order',10);
fplot ([T6 T8 T10 f])
xlim ([-4 4])
grid on
legend(O(x^6)', O(x^8)', O(x^{10})','sin(x)')
title('Taylor Series Expansion')

Taylor series in multiple variables

syms x y z
f = sin(x) + cos(y) + exp(z);
T = taylor(f)
%taylor series plot
syms x
f = sin(x);
T6 = taylor (f, x);
T8 = taylor (f, x,'Order',8);
T10 = taylor (f, x,'Order',10);
fplot ([T6 T8 T10 f])
xlim ([-4 4])
grid on
legend(O(x^6)', O(x^8)', O(x^{10})',
'sin(x)')
title('Taylor Series Expansion')