I need to write a function that computes the Taylor polynomial P_n(x) for a general odd number n>=1 using the built-in Matlab function polyval. I have the following function so far for the Taylor polynomial:
[ y ] = ost_arctanTaylor(n, x) %Computes the Taylor polynomial for f(x) = atan(x)
for i = 1:2:n y = ((-1).^(i)).*((x.^(2.*i-1))./(2.*i-1)); end end
I am confused on how to integrate the polyval function into this code. Any help?
Best Answer