Determining the right relative and absolute tolerances
3 次查看(过去 30 天)
显示 更早的评论
My program generates an essentially sinusoidal output. Using the various relative and absolute tolerances I obtained the following fits to a sine function (with about 2e4 data points):
ReTol = 1e-5, AbTol = 1e-7, Sinefit amplitude = 22.1383, phase = -0.10532, fminsearch err = 71211.296;
ReTol = 1e-5, AbTol = 1e-8, Sinefit amplitude = 22.1383, phase = -0.10532, fminsearch err = 71211.296;
ReTol = 1e-6, AbTol = 1e-7, Sinefit amplitude = 24.5425, phase = +0.22298, fminsearch err = 61670.879;
ReTol = 1e-6, AbTol = 1e-8, Sinefit amplitude = 24.5335, phase = +0.22210, fminsearch err = 106022.2668;
I tend to choose ReTol = 1e-5, AbTol = 1e-7, as reducing absolute tolerance doesn't change the result. However if I reduce relative tolerance I obtain different results (especially the phase). Thus what should I choose? ReTol = 1e-5, AbTol = 1e-7, or ReTol = 1e-6, AbTol = 1e-7?
11 个评论
Torsten
2025-1-5
编辑:Torsten
2025-1-5
As I answered in another question of yours
, it's impossible to get more maxima because the number of maxima if given by the solution of the PDE system. E.g. if your solution were y(x)=sin(x), you would get maxima and minima at odd multiples of pi/2, and no modification of the code could give you more of them. Or do I get wrong what you are asking for ?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Eigenvalue Problems 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!