Hi,

According the index line 37 I have either "Bounds error" and "Inexact 
error" (line in red). What's the matter, is it the type ?

Thanks !

Emi

#split step fourier method
#16/03/2016

using Gadfly

####################################################################

cputime=0
tic();
ln=1;
Po=.00064; #input power in watts
L = 12 # lenght of the fiber
Α=0;# fiber loss value in dB/km
α =Α/4.343;#ref page %55 GP Agrawal
γ=0.003; #fiber non linearity in /W/m
to=125e-12;  #initial pulse width in second
C= -2; # Input chirp parameter for first calculation
b2=20e-27 # 2nd order disp. (s2/m)
Ld=(to^2)/(abs(b2)); # dispersion length in meter
Ao=sqrt(Po); # Amplitude
i = complex(1, pi/2);
start = 0.1;
step = 0.1;
stop = 1.5;
nb_points = 14; # a recalculer à la main à chaque fois
iim = linspace(start, stop, nb_points);
###################################################################

τ= - 4096e-12:1e-12:4095e-12; #dt=t/to
dt=1e-12;
rel_error=1e-5;
h=1000;#step size

u=Ao*exp(-((1+im.*(-C))/2).*(τ/to).^2);
plot(x=τ,y=abs(u),Geom.line,Guide.xlabel("Time"), 
Guide.ylabel("Amplitude"), Guide.title("Input pulse"));

for k = 1:nb_points # the various fiber lengths can be varied and this 
vector can be changed
    ii = iim[k];
    l=maximum(size(u));
    fwhm1=find(abs(u).>(maxabs(u)./2));
    fwhm1=length(fwhm1);
    dw = 1/1/dt*2*pi;
    w = (-1*1/2:1:1/2-1)*dw;
    u = fftshift(u);
    w = fftshift(w);
    spectrum = fft(fftshift(u)); #Pulse spectrum
    for jj=h:h:10000
      spectrum = spectrum.*exp(-α*(h/2) + i*b2/2*w.^2*(h/2));
      f = ifft(spectrum);
      f = f.*exp(i*γ*((abs(f).^2)*h));
      spectrum = fft(f);
      spectrum = spectrum.*exp(-α*(h/2)+i*b2*w.^2*(h/2));
    end
    f = ifft(spectrum);
    op_pulse(ln)= abs(f);
    fwmh = find((abs(f)).>(abs(maxabs(f)./2)));
    fwmh = length(fwmh);
    ratio = fwmh./fwhm1;
    pbratio = ratio[k];
    dd = atand((abs(imag(f)))/(abs(f)));
    phadisp = dd[k];
end
toc;
cputime = toc;
plot(x=ln,y=pbratio,Geom.line,Guide.xlabel("Number of steps"), 
Guide.ylabel("Pulse Broadening ratio"));
plot(x=ln,y=phadisp,Geom.line,Guide.xlabel("Distance travelled"), 
Guide.ylabel("Phase change"));
draw(PDF("split_step_fourier_method.pdf", 6inch, 6inch), vstack(p1,p2,p3));



Reply via email to