MATLAB Answers

Curve tolerance between the calculated points

2 ビュー (過去 30 日間)
Ilya 2014 年 2 月 6 日
編集済み: Ilya 2014 年 2 月 6 日
In order to plot a curve in MATLAB a set of points is calculated based on some formula. The function FPLOT also supports plotting with some tolerance. Its help says the following about this functionality:
The FPLOT function begins with a minimum step of size (XMAX-XMIN)*TOL.
The step size is subsequently doubled whenever the relative error
between the linearly predicted value and the actual function value is
less than TOL.
So, if I plot a curve based on some expression and with some predefined tolerance TOL, is the error of the line segment approximation between any two calculated points always smaller than TOL?
Sorry, this is not obvious for me.
A confident yes/no answer would suffice, but it's also better to explain the reason and/or give an estimate for the maximal error of approximation of a curve with linear segments if a tolerance algorithm like in FPLOT is used.
  4 件のコメント
Matt J
Matt J 2014 年 2 月 6 日
I can delete it (or a forum administrator can do this..) if such excerpts are not allowed.
No, I meant you should provide a link to it so that we can know where to find it and read its full text. It wasn't in the help doc...



John D'Errico
John D'Errico 2014 年 2 月 6 日
編集済み: John D'Errico 2014 年 2 月 6 日
No. You cannot know the maximum error of approximation between parts of the curve that were not sampled. I can always give you any simple (and very well behaved) curve, plus a delta function in some spot that will not have been sampled. The error of approximation can then be arbitrarily large, and fplot will never know it.
Of course, the curve I suggested as a counter-example will not be continuous or even differentiable. However, if you want that property and still see fplot "fail" to see that spike, then just add a Gaussian instead of a delta function to the well-behaved function, but choose a Gaussian with an extremely small width. As such, it behaves like a delta function, but is still theoretically infinitely differentiable.
Thus you cannot assure that the error will ALWAYS be smaller than tol, for any supplied tolerance. This is a fundamental issue with virtually any computational algorithm when applied to a completely general function. You can always choose some (locally degenerate) function that will cause it to "fail" to achieve a given tolerance.
  3 件のコメント
Ilya 2014 年 2 月 6 日
Thanks a lot, this is now a quite complete information about the topic.


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by