I am surely one of the people who answered at least some of the questions you have found, but I'm not sure what is your problem. It looks like you are overwhelmed with what you have not really learned.
As you have learned, there are many ways to solve a problem of this sort. But since you have a long time series, the best way to solve the problem with a noisy series is Savitsky-Golay. It does smoothing as well as differentiation in one step, and to some extent, you can control the amount of smoothing to be done.
You don't even need to know how to write such a tool. Just look on the file exchange. I've even got one tool on there for this class of problem:<http://www.mathworks.com/matlabcentral/fileexchange/16997-movingslope movingslope>.
The call will be as simple as:
dydx = movingslope(y,supportlength,modelorder);
Here modelorder is an integer, which defines the order of the local polynomial model to be employed. modelorder=1 or modelorder=2 will be entirely adequate almost always. With very long sliding windows, you might use a somewhat higher order model, perhaps as much as 4.
supportlength is an integer. larger values will give more smoothing. It must be larger than modelorder. If your data is quite noisy, then you will need a long supportlength.
As an example, with VERY noisy data...
x = 0:10000;
y = sin(x/500) + randn(size(x))/10;
plot(x,y,'.')
yprime = movingslope(y,500,2);
The result should look reasonably close to 0.002*cos(0.002*x). In fact, it did quite well, except for those peaks and valleys, where the window length was too large for a locally quadratic model to be sufficient. So using an even longer window length to get sufficient smoothing, plus a 4th order model, we can get this estimate:
yprime = movingslope(y,1000,4);
plot(x,yprime,'b-',x,0.002*cos(x*0.002),'-r')
It missed just a bit near the start, due to the relatively high curvature there, and just natural randomness of the data.
Best Answer