1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| %Code Matlab
clc;
q=1;
Pi=input('Enter the value of input power in mW ')
alpha=input('Enter the value of fiber loss in db/km ')
t=input('Enter the value of input pulse width in seconds ')
tau=input('Enter time period with upper(U), lower(L) and interval between upper and lower interval(I) in this format L:I:U')
dt=input('enter intervel of period')
Area=input('Enter the area of effective core in m^2 ')
C=input('Enter the value of chirp factor ')
Lamda=input('Enter the wavelength in meters ')
D=input(' Enter the value of dispersion coefficient ps/nm/km ')
s=input('Enter the length of fiber in Km ')
disp('Fiber losses in /km ')
A=alpha/(4.343)
c=3*1e8;
n1=1.48;
pi=3.1415926535;
%delta=0.01
delta=(n1*2*pi*s)/Lamda
n2=7e-10
n2=n1*(1-delta)
f=c/Lamda;
omega=2*pi*f;
a=n2*omega;
b=c*Area;
gamma=a/b %calculation of nonlinear coefficient
%gamma=0.003;
B2=-(Lamda^2*D)/(2*pi*c) % calculation of group velocity dispersion coefficient
L=(t^2)/(abs(B2)) %dispersion length
Ao=sqrt(Pi) % amplitude of an input gaussian pulse
h=2000 % small step as defined by split step algorithm
for ii=0.1:0.1:(s/10) %different fiber lengths
X=ii*L;
At=Ao*exp(-((1+i*(C))/2)*(tau/t).^2); % generation of an gaussian input pulse
figure(1)
plot(abs(At)); % graph of input pulse
title('Input Pulse'); xlabel('Time in ps'); ylabel('Amplitude');
grid on;
hold off;
l=max(size(At));
fwhmi=find(abs(At)>abs(max(At)/2));
fwhmi=length(fwhmi);
dw=1/l/dt*2*pi;
w=(-1*l/2:1:l/2-1)*dw;
At=fftshift(At);
w=fftshift(w);
spec=fft(fftshift(At)); %generating a pulse spectrum
for j=h:h:X
spec=spec.*exp(-A*(h/2)+i*B2/2*w.^2*(h)) ; % calculation of linear part of NLSE
f=ifft(spec);
f=f.*exp(i*gamma*((abs(f)).^2)*(h)); %calculating nonlinear part of NLSE
spec=fft(f);
spec=spec.*exp(-A*(h/2)+i*B2/2*w.^2*(h)) ; % NLSE calculation
end
f=ifft(spec); % pulse propagation
output_pulse(q,:)=abs(f); %preserving output pulse
fwhmo=find(abs(f)>abs(max(f)/2));
fwhmo=length(fwhmo);% finding the Full width half maximumof output signal
pbratio(q)=fwhmo/fwhmi; %finding pulse brodening ratio
q=q+1;
end
figure(2);
mesh(output_pulse(1:1:q-1,:)); %output spectrum
title('Pulse Evolution');
xlabel('Time'); ylabel('distance in km'); zlabel('amplitude');
figure(3)
plot(pbratio(1:1:q-1)); %pulse broadening plot
xlabel('distance in km');
ylabel('Pulse broadening ratio');
grid on;
hold on;
%Calcul du BER.
Q=input('enter the value of Q factor in db');
Pi=3.14
A=(1/2*Pi)
B=exp(-Q^2/2)
disp('The BER for value of Q is')
BER=A*(B/Q) |
Partager