Hi! I have problems when I'm trying to do numerical differentiation.
I have an array with 9 data points that represents f(x) for 9 different x. Note that these are actual measurements with error and there is no "real" function f. I need to find f''(x) numerically. The values I have for x and f(x) are
and I can interpolate to get a smooth curve. I use spline interpolation but is some other interpolation preferable when you are going to differentiate?
Non of this have worked satisfactory. The second derivative is very unstable with respect to the step length and the adaptive method in the derivest suite works terribly bad. Maybe I'm just using it in the wrong way!
What do you expect as 2nd derivative of noisy data? Any level of smoothness will be purely injected by the computational method. Therefore the results will be too artificial to be reliable.
Do you have any information about the physical object behind the measurement? Then a good strategy is to fit the model parameters to the measurement data. E.g. if the values are the position of a pendulum, you adjust the string length until the trajetory matchs your data in abest way. Then the 2nd derivative will be easy to calculate, smooth and reliabale. But imagine, the values are stock prices - then a 2nd derivative would be even meaningless.
Without considering the physical model, smooth 2nd derivatives are as magic as predicting the value of a die based on any combination of the previous values.
This did actually work pretty well. At least better than the methods I came up with my self! However, I found out that the SLM tool did the trick! I really recommend it!
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.