Is numeric gradient estimation well-posed
2 次查看(过去 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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Financial Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!