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.

回答(1 个)

Chris McComb
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 个评论
Henrik Dam
Henrik Dam 2015-3-4
Hi! Thanks. Theoretically it should be a smooth function. It will be of many variables though, would you suggest plotting one or two variables at a time holding the other variables fixed? What would be an upgrade compared to the gradient function?
Chris McComb
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 CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by