2
$\begingroup$

Let's say I would like to find a point of inflexion of a digital signal which has been gathered via sampling of a continuous time domain signal with sampling period $100\,\mu s$. The digital signal plot looks like that

enter image description here

My first idea was to use the moving average filter for preprocessing of the original digital signal, compute the derivative of the filtered signal and based on that find the point of inflexion.

enter image description here

This approach revealed to be unappropriate because the derivative still contains noise despite the moving average filtering.

enter image description here

I have made the experiments with various window lengths (16, 32, 64, 128, 256) of the moving average filter but without any positive influence on the level of noise present in the derivative. Can anybody recommend me better approach for finding the point of inflexion of a digital signal?

EDIT:

I have decided to choose different approach based on curve fitting. This idea exploits the fact that the original digital signal is a step response of a continuous time domain first order system with transport delay i.e. system whose transfer function is

$$\frac{A}{\tau\cdot s + 1}\cdot e^{-s\cdot T_d}$$.

So the Laplace transform of the step response should be

$$A\cdot\frac{\frac{1}{\tau}}{s\cdot(s + \frac{1}{\tau})}\cdot e^{-s\cdot T_d}$$.

I think that based on that I can say that the fitting curve should be in following form

$$A\cdot\left[1 - e^{(-\frac{t-T_d}{\tau})}\right]$$.

So the unknown parameters for the least square algorithm are $A, T_d, \tau$. I have used the function leastsq of the Scilab software package for that task and I have received following output

enter image description here

Which is a surprising for me because it reveals that the system has probably more complex dynamics.

$\endgroup$
6
  • $\begingroup$ I must admit from looking at your signal, I am, as a human observer, also not 100% sure which point you'd like your algorithm to find. Can you tell us which $t$ is the "correct" one? $\endgroup$ Dec 1 '21 at 15:08
  • $\begingroup$ @MarcusMüller thank you for your reaction. I am sorry if my question isn't stated in clear manner. The correct value of $t$ is unknown for me at the time being and I would like to find it via inspection of the first derivative. $\endgroup$
    – Steve
    Dec 1 '21 at 15:23
  • $\begingroup$ yes, but looking at the pictures, your signal has multiple inflexion points, so I don't even thing there is a single correct value, which is why I asked what you think should be the right one $\endgroup$ Dec 1 '21 at 15:31
  • $\begingroup$ I am sorry. Now I see your comment. I am interested in the point of inflection which is placed in the time interval $<0, 0.01>\, s$. $\endgroup$
    – Steve
    Dec 1 '21 at 15:50
  • $\begingroup$ ah, do you have any knowledge about a limit in bandwidth or slew rate of your analog signal? $\endgroup$ Dec 1 '21 at 15:51
2
$\begingroup$

I'm not quite sure this works, but here's an attempt: just median filter your derivative (gradient) and use the peak of that.

I synthesized something like your signal:

Synthetic signal

And then took the derivative:

Derivative of synthetic signal

And then median filtered it (the peak is indicated with the red dot):

Median filtering of derivative, with red dot indicating peak


Python code below

import matplotlib.pyplot as plt
import numpy as np
from scipy import signal

T = 1024
Ton = 100

x = np.random.normal(0,0.1, T)

for t in np.arange(Ton,T):
    x[t] = x[t] + 10*(1-np.exp(-(t-Ton)/50))

dxdt = np.gradient(x)
median_dxdt = signal.medfilt(dxdt,31)

mx = median_dxdt.max()
ix = np.argmax(median_dxdt)

plt.figure(1)
plt.plot(x)

plt.figure(2)
plt.plot(dxdt)

plt.figure(3)
plt.plot(median_dxdt)
plt.plot(ix,mx,'r.')
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.