I have a csv file of data sampled with Ts=1ns which looks like this:
This signal is a step response of some system which responds to a step of value 1.
I'm trying to get the impedance profile of the signal by using
$$
Z\left( f \right)=\frac{V\left( f \right)}{I\left( f \right)}=\mathcal{F}\left\{ \frac{1}{A}\frac{\partial }{\partial t}v\left( t \right) \right\}
$$
The signal is noisy and needs filtering, so i'm separating the droop part from the non-droop part and filtering them independently using savgol filter.
Than, i'm applying FFT on each of the signal parts above using the following code:
n = 1024
from scipy.fftpack import diff
frqs = np.fft.fftfreq(n, d=1.0 * 1.e-9)[range(n // 2)]
Y = np.fft.fft(diff(data_y, order=1), n=n, norm='ortho') # fft computing and normalization
Y = abs(Y[range(len(frqs) // 2)])
return frqs, Y
Next, I take the high frequencies from the FFT applied on the droop part and the rest from the non-droop part and I stitch the results and plot them in log scale.
We get a result with expected shape as below:
Now, the problem arise when we change the droop part to be longer (and thus, the non-droop part to be shorter) as seen here:
The output of this looks like this:
The noisy shape is expected, but the amplitude is changing drastically and I can't figure out why. can someone point what the problems are are help with a solution?
Thanks!