Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: problem with split step method for generalized nonlinear schrodinger equation
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Aditi

Posts: 4
Registered: 5/9/13
problem with split step method for generalized nonlinear schrodinger equation
Posted: May 11, 2013 7:31 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

% his code is for solving generalized nonlinear schrodinger equation (GNLSE). i
% have done editing to the GP agrawal code for pure nlse ( without self-steeping term and raman term). but i am getting nan as output. please help !!!


clear all; %
distance = input('Enter fiber length (in units of L_D) ='); %
i = sqrt(-1);
beta2 = input('dispersion: 1 for normal, -1 for anomalous');%
beta3 = input('third order disperions');%
N = input('Nonlinear parameter N = '); % soliton order
mshape = input('m = 0 for sech, m > 0 for super-Gaussian = ');
chirp0 = 0; % input pulse chirp (default value)
%---set simulation parameters
nt = 1024; Tmax = 32; % FFT points and window size
step_num = round(20*distance*N^2); % No. of z steps to
deltaz = distance/step_num; % step size in z
dtau = (2*Tmax)/nt; % step size in tau
%---tau and omega arrays
tau = (-nt/2:nt/2-1)*dtau; % temporal grid
omega = (pi/Tmax)*[(0:nt/2-1) (-nt/2:-1)]; % frequency grid
%---Input Field profile
if mshape==0
uu = sech(tau).*exp(-0.5i*chirp0*tau.^2); % soliton
else % super-Gaussian
uu = exp(-0.5*(1+1i*chirp0).*tau.^(2*mshape));
end
temp = fftshift(ifft(uu)).*(nt*dtau)/sqrt(2*pi); % spectrum
figure; subplot(2,1,1);
plot(tau, abs(uu).^2, '--k'); hold on;
axis([-5 5 0 inf]);
xlabel('Normalized Time');
ylabel('Normalized Power');
title('Input and Output Pulse Shape and Spectrum');
subplot(2,1,2);
plot(fftshift(omega)/(2*pi), abs(temp).^2, '--k'); hold on;
axis([-.5 .5 0 inf]);
xlabel('Normalized Frequency');
ylabel('Spectral Power');
%---store dispersive phase shifts to speedup code
dispersion = exp(i*0.5*beta2*omega.^2*deltaz + beta3*omega.^3*deltaz); % phase factor
hhz = 1i*N^2*deltaz; % nonlinear phase factor


%*********[ Beginning of MAIN Loop]***********
% scheme: 1/2N -> D -> 1/2N; first half step nonlinear
temp = uu.*exp(abs(uu).^2.*hhz/2) + uu.*[exp(diff(abs(uu).^2).*hhz/2),1] + [diff(abs(uu).^2.*uu).*hhz/2, 1]; % note hhz/2,
% in the above line i have done editing to GP agrawal code for self steepening term and raman term
for n=1:step_num
f_temp = ifft(temp).*dispersion;
uu = fft(f_temp);
temp = uu.*exp(abs(uu).^2.*hhz) + uu.*[exp(diff(abs(uu).^2).*hhz),1] + [diff(abs(uu).^2.*uu).*hhz, 1]
% in the above line i have done editing to GP agrawal code for self
% steepening term and raman term ( same as above)
end
uu = temp.*(exp(abs(uu).^2.*hhz) + uu.*[exp(diff(abs(uu).^2).*hhz),1] + [diff(abs(uu).^2.*uu).*hhz, 1]) % Final field
temp = fftshift(ifft(uu)).*(nt*dtau)/sqrt(2*pi) %Final spectrum
subplot(2,1,1)
plot(tau, abs(uu).^2, 'k')
subplot(2,1,2)

plot(fftshift(omega)/(2*pi), abs(temp).^2, '-k')



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.