# How to find point of inflexion of a digital signal?

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

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.

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

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

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

• 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? Dec 1 '21 at 15:08
• @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. Dec 1 '21 at 15:23
• 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 Dec 1 '21 at 15:31
• 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$. Dec 1 '21 at 15:50
• ah, do you have any knowledge about a limit in bandwidth or slew rate of your analog signal? Dec 1 '21 at 15:51

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:

And then took the derivative:

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

# 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))

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.')