I know that I am not the first one with this problem, but I didn't manage to find the proper answer, so I hope you would like to help me.
From an electric circuit simulator, I simulated my circuit in time domain and saved a signal in a .txt file (which contains both time and signal values). Based on that .txt file, I would like to produce a FFT to see the signal in the frequency domain.
Unfortunately, the circuit simulator has a variable time step, which gives me a headache to obtain the correct FFT values (two-sided or one-sided is second priority at this point)
I managed to get some FFT out of my data, but I am having difficulties verifying the correctness of it, and hence appreciate any help on this matter. My simulation files give me different values for Average and RMS values, hence the confusion. Thank you. The link to my .txt file is given below (since I couldn't find a way to upload the txt file here directly): https://file.io/PXuD9sWR
My Python code:
import numpy as np from scipy.fftpack import fft import matplotlib.pyplot as plt import pandas as pd buckstruct = pd.read_csv('buck.txt', sep = '\\t', engine='python') bucktime = buckstruct.iloc[:,0] bucktime = bucktime.values.tolist() buckcurrent = buckstruct.iloc[:,1] buckcurrent = buckcurrent.values.tolist() bucktime_flt =  buckcurrent_flt =  # Filter out the start-up transient. Save only steady state values for i in range(len(bucktime)): if bucktime[i] > 0.002: bucktime_flt.append(bucktime[i]) buckcurrent_flt.append(buckcurrent[i]) plt.plot(bucktime_flt, buckcurrent_flt) buckfft = fft(buckcurrent_flt) buckfft_flt =  # Double the amplitude for harmonics as a first step to converter from two-sided to single-sided FFT for i in range(len(buckfft)): if i == 0: buckfft_flt.append(1.0/len(bucktime_flt)*abs(buckfft[i])) else: buckfft_flt.append(2.0/len(bucktime_flt)*abs(buckfft[i])) plt.plot(buckfft_flt)