Wanyu Lei many thanks for sharing your problem/question. Your signal looks like a capacitor discharge, with noise. It is also similar to something I came across during my PhD years: glottal closure, which is the vocal tract shape variation when we speak. I developed a method tracking it very accurately, which was quoted by many patents and articles later.
Let me explain the principle, you will see, it makes intuitive sense.
Rem1: You have a high frequency component on your signal, which you call noise.
Rem2: However the enveloppe of the signal is made of a convex part, and a concave part, which alternate.
Therefore you have two tasks:
-T1: filter the high frequency component
Easy, you can use something like this:
-call your instant signal s(t), integrate s as S (that is S(t) is the sum of the instant values s(u) for times u=t0 to current time t).
You can also do something tunable, with a learning factor L set to less than 1:
S(t+1)= Ls(t+1) + (1-L)S(t)
with L=0.1, you learn slowly and forget slowly (the memory effect is in S(t)), with L=0.9 you learn quickly and the past S(t) gets forgotten quickly.
Now you will work on S instead of s...
You may filter high frequency in any other way, that's ok.
-T2: detect convexity disruption
Easy: convexity is represented by the second derivative when functions are differentiable. For discrete time signals an equivalent of derivative for f is given by the increase D=f(t)-f(t-1), and the second derivative is represented by the second level of increase: the difference between consecutive increase rates (f(t+1)- f(t))
and (f(t)-f(t-1). This is D2 = f(t+1) - 2f(t) +f(t-1)
You apply this to f=S... Look for when the second level of increase D2 changes sign clearly (threshold).
Note that scientific history has an interesting case where this has been applied: gravity. Galileo looked at z(t) the height of an object in free fall (the legend says from the Pisa tower), and found that D2 = g... approximately 9.8, as we know...
F = m g
I you are still unsure please refer to my article here:
Article Detection of the glottal closure by jumps in the statistical...
The frequency of your signal is low compared to the artifact that has polluted it. So, you can find its fourier transform. Then remove the high frequency components, and your signal will be denoised.
I have uploaded a MATLAB code that will give you the frequency content of your time-domain signal. If you want to be precise for seeing the frequency content then you select a particular time span in this code so that you will get the frequency content of that particular time-domain signal.
Once you see the maximum peak value (f in Hz) of the frequency plot then you can calculate the period just by [period = 1/f].
Whilst Fourier transform of the signal is indeed a rather suitable method, an alternative dirt and quick way would be calculating the rolling standard deviation (say, over 5 data points) and then look for its maximum to minimum transition (or, technically correct but could lead to artefacts, the zero value of its smoothed second central derivative).
Wanyu Lei many thanks for sharing your problem/question. Your signal looks like a capacitor discharge, with noise. It is also similar to something I came across during my PhD years: glottal closure, which is the vocal tract shape variation when we speak. I developed a method tracking it very accurately, which was quoted by many patents and articles later.
Let me explain the principle, you will see, it makes intuitive sense.
Rem1: You have a high frequency component on your signal, which you call noise.
Rem2: However the enveloppe of the signal is made of a convex part, and a concave part, which alternate.
Therefore you have two tasks:
-T1: filter the high frequency component
Easy, you can use something like this:
-call your instant signal s(t), integrate s as S (that is S(t) is the sum of the instant values s(u) for times u=t0 to current time t).
You can also do something tunable, with a learning factor L set to less than 1:
S(t+1)= Ls(t+1) + (1-L)S(t)
with L=0.1, you learn slowly and forget slowly (the memory effect is in S(t)), with L=0.9 you learn quickly and the past S(t) gets forgotten quickly.
Now you will work on S instead of s...
You may filter high frequency in any other way, that's ok.
-T2: detect convexity disruption
Easy: convexity is represented by the second derivative when functions are differentiable. For discrete time signals an equivalent of derivative for f is given by the increase D=f(t)-f(t-1), and the second derivative is represented by the second level of increase: the difference between consecutive increase rates (f(t+1)- f(t))
and (f(t)-f(t-1). This is D2 = f(t+1) - 2f(t) +f(t-1)
You apply this to f=S... Look for when the second level of increase D2 changes sign clearly (threshold).
Note that scientific history has an interesting case where this has been applied: gravity. Galileo looked at z(t) the height of an object in free fall (the legend says from the Pisa tower), and found that D2 = g... approximately 9.8, as we know...
F = m g
I you are still unsure please refer to my article here:
Article Detection of the glottal closure by jumps in the statistical...
To simplify to the extreme, on your low-pass filtered signal S (from original s with high frequency components) you track D2 = S(t+1) - 2S(t) +S(t-1) which is an estimate of the second derivative. In convex areas, D2 is positive, in concave areas, it is negative. You detect your "onset" time t(O), as you call it, by looking at when D2 goes from being consistently negative to being consistently positive. If this helps please click "recommend" so that others are aware of what solves your problem completely...
You seem to be interested in detecting a specific position (rather than the period) of a signal in noise. The optimal way to do this is a Wiener filter.