MATLAB File for Bragg Grating

2
clear all close all clc walD = 1.55e-6; wal1 = 0.999*walD; wal2 = 1.001*walD; step = 500; wal = [wal1:(wal2-wal1)/step:wal2]; Rma = 0.2; rma = s!rt(Rma); "ac# = ata$%(rma); c = 2.99&9'e ; % = 25e-9; = 1; $e = 1.+&; # = '000e-6; , = 100; = #/,; o = - # 10.69e-'; "ac = "ac#/#; " c = 2*"ac/ ; or (r = 1:step 1) w = wal(r); = [1 0; 0 1]; or(s = 1:,) et = 2*p *$e *(1/w - 1/walD); c = et " c; p1 = s!rt("ac32 - c32); p2 = c32/"ac32; 11 = cos%(p1* ) - *( c/p1)*s $%(p1* ); 12 = - *("ac/p1)*s $%(p1* ); 21 = *("ac/p1)*s $%(p1* ); 22 = cos%(p1* ) *( c/p1)*s $%(p1* ); = [ 11 12; 21 22]; = *; e$ r'(r) = (241)/ (141); R'(r) = (a s(r'(r)))32; e$ 78 = 2*p *$e * o/w; p%ase ere$ce etwee$ rat $ s p = [ep(- * 78) 0; 0 ep( * 78)]; p = * p* ; t'(r) = 1/ p(141); ampl t e tra$sm ss o$ coe c e$t '(r) = (a s(t'(r)))32; power tra$sm ss o$ coe c e$t o a r<- erot lter t%eta = p%ase(r'); t%eta1 = ra e$t(t%eta4 %); t%eta2 = ra e$t( t%eta14 %); D #>?' = -((wal.32)./(2*p *c)).* t%eta1; D #>? ' = D #>?'*1e12; ela< $ (ps) D8@ R@8AB' = (2*D #>?'./wal) - ((wal.32)./(2*p *c)).* t%eta2; D8@ R@8AB ' = D8@ R@8AB'*(1e12/1e9); spers o$ $ (ps/$m) plot(wal*1e94 R'4 C"C) r a s([15+9 1551.5 0 0.2]) t tle( CRe lect o$ @pectr m o ra Re lectorC ) la el( CEa ele$ t% ($m)C )

description

Code for Bragg on MATLAB

Transcript of MATLAB File for Bragg Grating

clear allclose allclcwalD = 1.55e-6;wal1 = 0.999*walD;wal2 = 1.001*walD;step = 500;wal = [wal1:(wal2-wal1)/step:wal2];Rmax = 0.2;rmax = sqrt(Rmax);kacL = atanh(rmax);c = 2.99793e8;h = 25e-9;v = 1;nef = 1.47;L = 3000e-6;M = 100;dz = L/M;dzo = - L + 10.69e-3;kac = kacL/L;kdc = 2*kac/v;for (r = 1:step+1)w = wal(r);F = [1 0; 0 1];for(s = 1:M)det = 2*pi*nef*(1/w - 1/walD);gdc = det + kdc;p1 = sqrt(kac^2 - gdc^2);p2 = gdc^2/kac^2;f11 = cosh(p1*dz) - i*(gdc/p1)*sinh(p1*dz);f12 = -i*(kac/p1)*sinh(p1*dz);f21 = i*(kac/p1)*sinh(p1*dz);f22 = cosh(p1*dz) + i*(gdc/p1)*sinh(p1*dz);ff = [f11 f12; f21 f22];F = ff*F;endr3(r) = F(2,1)/F(1,1); R3(r) = (abs(r3(r)))^2;endPHI = 2*pi*nef*dzo/w; %phase difference between gratingsFp = [exp(-i*PHI) 0; 0 exp(i*PHI)];Ffp = F*Fp*F;t3(r) = 1/Ffp(1,1); %amplitude transmission coefficientT3(r) = (abs(t3(r)))^2; %power transmission coefficient of%Fabry-Perot filtertheta = phase(r3);dtheta1 = gradient(theta, h);dtheta2 = gradient(dtheta1, h);DELAY3 = -((wal.^2)./(2*pi*c)).*dtheta1;DELAYu3 = DELAY3*1e12; %delay in (ps)DISPERSION3 = (2*DELAY3./wal) - ((wal.^2)./(2*pi*c)).*dtheta2;DISPERSIONu3 = DISPERSION3*(1e12/1e9); %dispersion in (ps/nm)plot(wal*1e9, R3, 'k')gridaxis([1549 1551.5 0 0.2])title('Reflection Spectrum of Bragg Reflector')xlabel('Wavelength (nm)')ylabel('Power (p.u)')