- **Main CFD Forum**
(*https://www.cfd-online.com/Forums/main/*)

- - **Derivation by spectral method
**
(*https://www.cfd-online.com/Forums/main/8570-derivation-spectral-method.html*)

Derivation by spectral method
I want to evaluate the derivative of a function f=f(x) periodical, by a spectral method. Let's say
(1) f(j)=1/N*SUM(with k=from 1 to N) ( Ck*exp(-i*2pi*(k-1)*(j-1)/N ) where j= index of point N= number of points k is the wave number f is the fundamental frequency N is the number of points Ck are the spectral coefficients The (1) is the Discrete Fourier decomposition. Now, I calculate the Ck coefficients by the inverse trasformation and I can use the (1) to re-build my function. At the same time I can use the Ck to calculate the derivative of the expression (1), which should be: (2) df(j)=1/N*SUM(with k=from 1 to N) (-i*2*pi*(k-1)*Ck/(N*DX))*exp(-i*2pi*(k-1)*(j-1)/N ) where DX is the sample. What happens to me is that The re-built function is correct, but not the derivative! Do you have any hint? |

Re: Derivation by spectral method
Looks like you're trying to take the derivative with respect to x, where x_j = (j-1)/N. So, you are adding an unneeded factor 1/N*DX in your derivative.
Also, shouldn't you be using negative k values as well, like k=-N/2,...,N/2-1 ? |

All times are GMT -4. The time now is 01:47. |