フィルターのクリア

Writing equation in a Taylor Series?

1 回表示 (過去 30 日間)
Tyler Silva
Tyler Silva 2015 年 10 月 12 日
コメント済み: Thorsten 2015 年 10 月 13 日
Im writing this script, and my outputs dont come out. My count variable produces a number, but Difference outputs NaN and Estimate always outputs - Inf after i run the code. My equation for the Taylor Series is under the variable 'Estimate' from the pdf. Do i need a Previous=Difference line in there also or is that unnecessary?

採用された回答

Thorsten
Thorsten 2015 年 10 月 12 日
編集済み: Thorsten 2015 年 10 月 12 日
No, you don't need the previous=difference line, it's wrong. Also count starts at 1 in the formula but at 0 in your code.
There are also errors in your first while loop. Can the expression ever become True? Or does it change inside the loop?
  2 件のコメント
Tyler Silva
Tyler Silva 2015 年 10 月 12 日
Well the difference will exceed that number and we still want the while loop to continue after it does
Thorsten
Thorsten 2015 年 10 月 13 日
The difference is the difference between the Taylor sum for i = n and i = n + 1; you compute this correctly as
Difference=abs(Previous-Estimate);
However, if you set
Previous = Difference;
you do something wrong, because previous is no longer the result of the previous estimation. Without this line and count = 1 the estimation works fine.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by