Error using Taylor with order n as variable

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.

 採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 11 日
編集済み: Sulaymon Eshkabilov 2019 年 10 月 11 日

0 投票

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.

1 件のコメント

Qingyang Zhang
Qingyang Zhang 2019 年 10 月 11 日
Thanks.
So, can I set Order as a variable?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by