Using fft, ifft and fftshift in matlab

I am trying to implement the split-step fourier method to solve the nonlinear Schrödinger equation in optics. It mainly considers the linear part and the nonlinear part separately. It solves the linear part using the Fourier transform and the nonlinear part in the time domain.

The following code is copied from the book:

alpha = 0
beta_2 = 1
gamma = 1

T = linspace(-5,5,2^13);
delta_T = T(2)-T(1);

L = max(size(A));
delta_omega = 1/L/delta_T*2*pi;
omega = (-L/2:1:L/2-1)*delta_omega;

A = 2*sech(T);
A_t = A;
step_num = 1000;
h = 0.5*pi/step_num;
results = zeros(L,step_num);

A_f = fftshift(fft(A_t));
for n=1:step_num
    A_f = A_f.*exp(-alpha*(h/2)-1i*beta_2/2*omega.^2*(h/2));
    A_t = ifft(A_f);
    A_t = A_t.*exp(1i*gamma*(abs(A_t).^2*h));
    A_f = fft(A_t);
    A_f = A_f.*exp(-alpha*(h/2)-1i*beta_2/2*omega.^2*(h/2));
    A_t = ifft(A_f);
    results(:,n) = abs(A_t);
end

A_t - (, ). , fftshift , fftshift. fftshift . , ? , fftshift ifftshift, , ?

+4
1

, , , .

-, fftshift ifftshift , .

  • fft , 0, , . ifft.

  • , -5 5, 0 10.

  • fftshift , 0.

  • fft ifft ( ), ifftshift. ifft. fftshift.

    , -

(): {

( -ve + ve , ):

  • ifftshift, fft ifft
  • fftshift , , .

( ):

  • fft ifft.
  • fftshift , .

( fft, ifft):

  • , . , .

}

0

Source: https://habr.com/ru/post/1684046/


All Articles