lambda = 1.55;

d = 1;

b1 = sqrt((2*pi/lambda)^2-(pi/(2*d))^2);

b2 = sqrt((2*pi/lambda)^2-(pi*2/(2*d))^2);



z = linspace(0,10,1000);

a4 = 32/(9*pi^2)*exp(-j*b1*z)+1/2*exp(-j*b2*z);

a5 = 32/(9*pi^2)*exp(-j*b1*z)-1/2*exp(-j*b2*z);

plot(z,abs(a4).^2); hold on;

plot(z,abs(a5).^2,'r--');

legend('P_4','P_5');

xlabel('Length of waveguide coupling section 3, [{\mu}m]');

ylabel('Output power');

title('Problem 6a: Power sloshing between MMI coupler outputs');

