Numerical stability of fft/ifft algorithm

9 vues (au cours des 30 derniers jours)
ACE
ACE le 19 Août 2013
Short: The IFFT of a function matches an analytic solution if sampling points in spectral space (k) "reasonable", but will yield an exponential growth if k becomes large. Is there numerical stability restriction on the IFFT algorithm?
Long: The code I am writing takes a force in physical space, F(x,z) which is defined over a domain L and with a sampling separation dx, transforms it to spectral space (x transforms to wavenumber k, z is not transformed), uses the result to construct another function, u(k,z), and then transforms the new function back to physical space, U(x,z). Here is a snippet of pseudocode:
x = array of uniformly spaced points from -2L to 2L ;
z = array of logarithmically spaced points from z0 to 3L;
Nx = number of points in x direction;
Nz = number of points in z direction;
dk = 2*pi/dx;
k = dk*(0:Nx/2)/Nx;
Nk = Nx/2+1;
f = f(x,z); %function in physical space
f_tilda = fft(f);
f_tilda = f_tilda(1:Nx/2+1,:)*dx/(2*pi);
u_tilda = u_tilda(k,z); %function in spectral space, evaluated over positive k
u_tilda = cat(1, u_tilda, conj(u_tilda(end-1:-1:2,:))); %u_tilda is known to be hermitian
u = real(ifft(u_tilda)*(2*pi/dx));
I have an analytic solution to compare the code against, and what I am finding is that if I choose L and dx "properly" the code matches the analytic solution reasonably well. But if dx taken too small or L taken too small, the result is exponential growth.
Could this be a problem with numerical stability of the IFFT/FFT algorithm?

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by