why fplot take more time to run here?

2 ビュー (過去 30 日間)
Jatin89
Jatin89 2014 年 3 月 20 日
編集済み: Star Strider 2014 年 3 月 20 日
Here is the line of code. my Question is why does #2 take more time than #1. 1) fplot('sin(x)',[0 2*pi],1e-2) 2) fplot('sin(x)',[0 2*pi],1e-6) Thanks

回答 (1 件)

Star Strider
Star Strider 2014 年 3 月 20 日
編集済み: Star Strider 2014 年 3 月 20 日
From the documentation for fplot:
-----
fplot(fun,limits,tol) plots fun using the relative error tolerance tol (the default is 2e-3, i.e., 0.2 percent accuracy).
. . .
fplot uses adaptive step control to produce a representative graph, concentrating its evaluation in regions where the function's rate of change is the greatest.
-----
It seems to me that a tolerance of 1E-6 would require more steps — and therefore more time to execute — than a tolerance of 1E-2.

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by