Derivative of noised function

57 Views Asked by At

Given a noisy smooth enough function, $f(x)=sin(x)$ find the derivative using the sliding derivative technique.

In the sliding derivative technique, we are performing the following steps:

The neighborhood of point $i$ in domain is characterized by the half-window length hw, thus for the i-point in the domain we are considering $[i-hw:i+hw]$ window

In this window the closest approximating line has to be found and the coefficient of it has to be determined which would be an approximation of the derivative.

I followed the above steps and applied regression to get the best line fit on the plotted points in the given window and then finding its coefficient.

But in this case the slope is remaining same for the given window. I tried it with multiple $hw$ values for the window.

Can you please let me know the correct approach for the same?