[Python] Python FFT - Output fft is the same as input function?

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to perform an FFT on data from a simulation that has an oscilating shape. When I run the scipy FFT, the output is the same as the input and I can't figure out why. My code is below:

    tstart = 7.5000000000039813e-2
    rho = 0.80272956E-04
    V = 4773.706375394508
    Aref = 0.203911
    Pnondim = 0.5 * rho * V**2 * Aref

    df1 = pd.read_csv('screenP.csv')
    P1 = -np.array(df1[:])/Pnondim
    CT = 1.52
    Ax1 = P1 + CT
    steps1 = len(P1)
    dt1 = 2e-7
    tend1 = tstart + steps1*dt1
    t1 = np.linspace(tstart,tend1,steps1) * 1000
    plt.plot(t1,Ax1)
    plt.show()

    X = fftpack.rfft(Ax1)
    freq = fftpack.rfftfreq(len(Ax1), dt1)

    plt.plot(freq, np.abs(X))
    plt.xlabel('Frequency (Hz)'), plt.ylabel('Power')
    plt.show()


    where screenP is data output from a CFD solver. The original curve and the fft output are shown below.

    https://i.sstatic.net/8iPa8.png

    https://i.sstatic.net/1Eja9.png

    Any help would be much appreciated.

    Continue reading...

Compartilhe esta Página