MATLAB: How to write a function to find the taylor series expansion of sin(x) to the 9th term

sinxsyntaxtaylor series

I am asked to create a function file to evaluate the value of sin(x) accurate to 9 Taylor Series terms. I know there is a way to write it all out using n and whatnot, but is there a simple way using the built in function "taylor()"? This is what I have, but I am not sure what is wrong.
function y = taylor9(x)
y = taylor(sin(x),x,'Order',9)
end
The error I get says "Undefined function 'taylor' for input arguments of type 'double'"

Best Answer

syms x
y = taylor(sin(x), x, 'Order', 9);