Need help with newton's theorem (matlab)
2 ビュー (過去 30 日間)
古いコメントを表示
After running script i put inittial starting point -3, tolerance parameter = 1e-5 , max iteration = 35,
however there is something wrong with the newton script i need to know what it is please thank you. i think the output after plotting fplot(function, [-15,1]) there is something wrong but i am not sure .
any help will be appreicated thanks
0 件のコメント
採用された回答
Richard Brown
2012 年 4 月 16 日
It works fine - you're just using a (contrived!) nasty example. Plot your function between -3 and 20 and see where the first Newton step takes you
6 件のコメント
Richard Brown
2012 年 4 月 16 日
It doesn't converge - your function has a limit of zero as x -> -inf, it ends up taking a step sufficiently far to the left that it reaches your tolerance - but it's not actually found a zero.
その他の回答 (2 件)
Sargondjani
2012 年 4 月 16 日
i dont think there is a perfect solution for this... a numerical algorithm that tries to find a minimum will have to stop somewhere: when the solution is 'good enough', ie. when the derivative is very close to zero.
For instance if you look for the maximum of the log function (or min. of -log), the derivate will go to zero as x grows larger, so at some point an optimizer will say: 'now i am sufficiently close. i stop', while in fact it is not maximum, as log is unbounded above...
so you will have to use your own good sense to prevent mistaking a solution for a global minimum (as it can be either a local minimum or not a minimum at all). i pretty sure there doesnt exists an operable algorithmm that always finds the global maximum or minimum as it is just too complicated...
so you will ALWAYS have to rely on analyzing the function in some other way as well...
1 件のコメント
Richard Brown
2012 年 4 月 19 日
Just to clarify: the OP is talking about Newton's method (Newton-Raphson) for zero finding, not for optimisation. So it's not trying to find minima at all.
PG
2012 年 4 月 19 日
3 件のコメント
Richard Brown
2012 年 4 月 19 日
You need to decide on a condition. It could be that the gradient is sufficiently nonzero, or that the difference between successive x values is also going to zero at a similar rate related to the rate the function value goes to zero, etc. etc. There is no "standard" answer - what you come up with will be a heuristic that works for your problem
参考
カテゴリ
Help Center および File Exchange で Linear Least Squares についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!