Is numeric gradient estimation well-posed
4 ビュー (過去 30 日間)
古いコメントを表示
Dear matlabcentral,
I'm working on my thesis in mathematical finance. As a small part of it I am to numerically find a gradient of a function which is pretty demanding to evaluate (involving Fourier inversion and afterwards ordinary inversion of a highly non-linear function, it evaluates pretty fast though). Can I expect accurate results? Can you recommend a function or implementation which generally does a good job? Any package and version can be assumed attainable.
I have done some Matlab programming, but I am probably a novice compared to you guys. I have never formally studied these kind of problems (numerical analysis?), so I have no idea of the well-posedness of numerical differentiation.
0 件のコメント
回答 (1 件)
Chris McComb
2015 年 3 月 4 日
It will depend a great deal on the characteristics of your function. If your function is smooth, then you can generally expect good results with numerical differentiation. However, if your function is noisy or discontinuous numerical differentiation becomes more troublesome.
When first implementing any method for finding the gradient, it may be a good idea to plot the original function in the same axes as the slope, to ensure that it is providing a good estimate.
As a starting point, I'd recommend MATLAB's gradient function.
2 件のコメント
Chris McComb
2015 年 3 月 4 日
Yes, I'd suggest plotting one variable at a time to check that the computed gradient matches the function. This will also allow to build up a gradient vector one element at a time.
Since your function is smooth, MATLAB's gradient() should work well (you can decrease the distance between adjacent points to increase accuracy). If you want something else you'll probably have to code it yourself. This is a pretty good reference.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!