The transfer function for the first LPF is represented as follows
Where,
is the cut-off frequency, and S is the variable in the Laplace transform. In real-time systems, this needs to be converted to discrete time. The first-order LPF at discrete time can be simply expressed in the following form where x[n] is the current input value,
y[n] is the current output value,
where y[n-1] is the previous output value,
α is a factor that determines the strength of the filter, and the time constant
τ and the sampling period
T to calculate it.
I think you can continue to get new inputs in this way and filter them by inputting the measured alpha value into the LPF according to the above formula. And if you adjust the cutoff frequency appropriately while simulating, you should be able to see the filtered signal with a slight delay.
I've never used latex before, so my answers may be terrible, sorry.