Error using Taylor with order n as variable

4 views (last 30 days)
I want to find several taylor polynomials with n = 1:10
I have the following code:
syms x;
syms n positive integer;
f(x) = atan(x);
P(x,n) = taylor(f, x, 'Order', n);
But there is a Error:
Error using sym/taylor (line 99)
The value of 'Order' is invalid. It must satisfy the function: isPositiveInteger.

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 11 Oct 2019
Edited: Sulaymon Eshkabilov on 11 Oct 2019
Hi,
Here is the complete answer to your exercise:
syms x
f(x) = atan(x);
syms ii positive integer;
for ii=1:10
P(ii) = taylor(f, x, 'Order', ii);
end
Good luck.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!