Experiment No 5
Experiment No 5
Experiment No 5
5
Objectives
Design of All Optical Full Adder/Subtractions logic gates using the Micro-ring
resonator structures
MATLAB CODE OPTICAL FULL ADDER
% Implmentation of Full ADDER
clc;
clear all;
close all;
k1 = 0.25;
k2 = 0.25;
alpha = 0.0005.*10.^(6);
Aeff = 0.25.*10.^(-12);
lembda = 1.55.*10.^(-6);
gamma = 0.005;
R = 7.08.*10.^(-6);
n0 = abs(.00017 + 0.0174i);
n2 =-abs(-6.9998e-016 -4.3554e-015i);
L = 2.*pi.*R;
D = sqrt(1-gamma);
x = D.*exp(-alpha.*L./4);
% Generation of continuous wave signal;
t = (-10:0.01:10).*10.^(-12);
z = (-10:0.01:10).*10.^(-12);
T0 = 1e-12;
L = 2.*pi.*5.81e-6;
c = 3e-8;
T = t;
w = ((2.*pi)./T);
LD = 500.81e-6;
w0 = (2*pi./T0);
alpha = 0.08;
%
*********************************************************
****************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
neff3 = n0 + n2.*(abs(X2)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,1);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time(ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,9);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time(ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,17);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time(ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,25);
plot(T./10.^(-12) + 1,abs(sum)./10);
xlabel('Time(ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,33);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time(ps)');
ylabel('Carry');
axis([0 2 0 1]);
%********************************************************
******************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
neff3 = n0 + n2.*(abs(X1)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(1i.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,2);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,10);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,18);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,26);
plot(T./10.^(-12) + 1,abs(sum));
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,34);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);
%*****************************************************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
neff3 = n0 + n2.*(abs(X2)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,3);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('A')
axis([0 2 0 1]);
subplot(5,8,11);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('B')
axis([0 2 0 1]);
subplot(5,8,19);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('C_i_n')
axis([0 2 0 1]);
subplot(5,8,27);
plot(T./10.^(-12) + 1,abs(sum));
xlabel('Time (ps)');
ylabel('Sum')
axis([0 2 0 1]);
subplot(5,8,35);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry')
axis([0 2 0 1]);
%********************************************************
******************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X2)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
neff3 = n0 + n2.*(abs(X1)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,4);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,12);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,20);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,28);
plot(T./10.^(-12) + 1,abs(sum)/10);
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,36);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);
%********************************************************
***************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
neff3 = n0 + n2.*(abs(X2)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,5);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,13);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,21);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,29);
plot(T./10.^(-12) + 1,abs(sum));
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,37);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);
%
*********************************************************
****************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X2)./Aeff);
neff3 = n0 + n2.*(abs(X1)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,6);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,14);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,22);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,30);
plot(T./10.^(-12) + 1,abs(sum)/10);
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,38);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);
%********************************************************
******************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
neff3 = n0 + n2.*(abs(X2)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,7);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,15);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,23);
plot(T./10.^(-12) + 1,abs(X2));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,31);
plot(T./10.^(-12) + 1,abs(sum)/10);
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,39);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);
%
*********************************************************
****************
x0 = sech(30.*T./T0).*exp((z));
X1 = sech(30.*T./T0).*exp((z));
X2 = zeros(1,2001);
neff1 = n0 + n2.*(((abs(X1)))./Aeff);
neff2 = n0 + n2.*(abs(X1)./Aeff);
neff3 = n0 + n2.*(abs(X1)./Aeff)
kn1 = ((2.*pi)./lembda).*neff1;
kn2 = ((2.*pi)./lembda).*neff2;
kn3 = ((2.*pi)./lembda).*neff3;
phi1 = (kn1.*L)./2;
phi2 = (kn2.*L)./2;
phi3 = (kn3.*L)./2;
% First stage calculation
et1 = (-sqrt(k1.*k2).*D.*exp(j.*phi1)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
ed1 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi1)).^2))).*x0;
% Second stage;
et2 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
ed2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*et1;
% Third stage
et3 = (-sqrt(k1.*k2).*D.*exp(j.*phi2)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
ed3 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi2)).^2))).*ed1;
% Forth stage
D7 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
D6 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et2;
% Fifth stage
D5 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
D4 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed2;
% Sixth stage
D3 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
D2 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*et3;
% Seventh stage
D1 = (-sqrt(k1.*k2).*D.*exp(j.*phi3)./(1 - sqrt(1-
k1).*sqrt(1-k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
D0 = ((D.*sqrt(1-k1) - D.*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))./(1 - sqrt(1-k1).*sqrt(1-
k2).*x.^2.*((exp(j.*phi3)).^2))).*ed3;
sum = D7 + D4 + D2 + D1;
carry = D7 + D6 + D5 + D3;
subplot(5,8,8);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('A');
axis([0 2 0 1]);
subplot(5,8,16);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('B');
axis([0 2 0 1]);
subplot(5,8,24);
plot(T./10.^(-12) + 1,abs(X1));
xlabel('Time (ps)');
ylabel('C_i_n');
axis([0 2 0 1]);
subplot(5,8,32);
plot(T./10.^(-12) + 1,abs(sum));
xlabel('Time (ps)');
ylabel('Sum');
axis([0 2 0 1]);
subplot(5,8,40);
plot(T./10.^(-12) + 1,abs(carry));
xlabel('Time (ps)');
ylabel('Carry');
axis([0 2 0 1]);