Berechnung des spektralen Ableitung mit scipy.fftpack (DST, DCT)Python

Python-Programme
Anonymous
 Berechnung des spektralen Ableitung mit scipy.fftpack (DST, DCT)

Post by Anonymous »

scipy.fftpack -Paket bietet eine große Anzahl von Routinen, die sich auf diskrete Fourier -Transformationen beziehen. Ich muss nur die 1. und 2. Ableitung einer Funktion unter Verwendung von DST (DCT) berechnen. Das Paket enthält jedoch Diff Routine, das k Th Derivat mit FFT

weiß, weiß jemand, wie man beispielsweise DST mit DST den 1. und 2. Derivaten bekommt? Hier ist mein Entwurf: < /p>

Code: Select all

import numpy as np
import matplotlib.pyplot as plt
from scipy.fftpack import dst, idst, dct, idct

L   = 10
N   = 100
a   = 0.4
x   = np.linspace(0,L,N)
# function
u   = np.sin(2*np.pi*x/L)*np.exp(-a*x)

# exact 1st derivative
du  = np.exp(-a*x)*(-a*np.sin(2*np.pi*x/L) + np.cos(2*np.pi*x/L)*2*np.pi/L)

# get 1st derivative
dufft = idst(-dct(u))

plt.figure()
plt.plot(x,u)
plt.plot(x,du)
plt.figure()
plt.plot(x,dufft)
plt.show()

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post