[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Cumulative Sum Question - Octave Newbie

**From**: |
Jordi Gutiérrez Hermoso |

**Subject**: |
Re: Cumulative Sum Question - Octave Newbie |

**Date**: |
Thu, 6 Jan 2011 18:03:58 -0600 |

On 6 January 2011 15:55, Jason Criss <address@hidden> wrote:
>* I have a cumulative sum of monotonic values that is a function of time (I*
>* don't have the analytic function, just the points). For each point along*
>* the function, I would like to know the slope. The issue is that the rate of*
>* change is very slow and a little noisy point-to-point so calculating the*
>* slope between adjacent points would yield a lot of noise.*
How about using a filter to get rid of the noise?
n = 100; x = rand(1,n); [b,a] = butter(3,0.2); plot(1:n,x, 1:n,
filtfilt(b,a,x))
You can vary the parameters of the Butterworth filter to see how much
smoothing you want. Once you have a smoother function, apply diff to
its output in order to get its derivative.
- Jordi G. H.