Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

correct the code the program

1 Ansicht (letzte 30 Tage)
shiv gaur
shiv gaur am 2 Feb. 2022
Geschlossen: Stephen23 am 2 Feb. 2022
w1 = 2*a; be1 = be; % save previous results for 2a=100
L1 = -1/2/imag(be1)/k0/1000; % propagation length in microns
wmax = pi/k0*sqrt(abs(real(ec)+1)) % max L at wmax = 1402.49 nm
bemax = pwg(la0,ef,ec,wmax/2,bcinf,0,tol); % bemax = 1.030361 - 0.000577i
Lmax = -1/2./imag(bemax)/k0/1000; % Lmax = 89.5901 microns
w = (5:10:3500); a = w/2; % vector of gap thicknesses w in nm
for i=1:length(w) % PWG method
be(i) = pwg(la0,ef,ec,a(i),bcinf,0,tol); % la0,ef,ec,bcinf,tol, as above
end
L = -1/2./imag(be)/k0/1000; % propagation length in micrometers
ac = sqrt(be.^2 - ec); ga = sqrt(be.^2 - ef);
E = abs(pc*ac + ga.*tanh(ga.*a*k0)); % vector of computational errors
figure; plot(w,real(be),’-’, w1,real(be1),’.’); % plot effective index
figure; plot(w,L,’-’, w1,L1,’.’, wmax,Lmax,’ro’); % plot propagation length
% ---------- iterative version ----------
for i=1:length(w)
binit = bcinf; % initialize iteration
ga = sqrt(binit^2 - ef);
ac = sqrt(binit^2 - ec);
N(i) = 1; % number of iterations for i-th thickness
while 1
ga_new = -pc*ac*coth(ga*a(i)*k0);
if abs(ga_new-ga) < tol, break; end
ga = ga_new;
beit(i) = sqrt(ga^2 + ef); % beta for i-th thickness
ac = sqrt(beit(i)^2 - es);
N(i) = N(i)+1;
end % end while-loop
end % end for-loop
ac = sqrt(beit.^2 -ec); ga = sqrt(beit.^2 - ef);
Eit = abs(pc*ac + ga.*tanh(ga.*a*k0)); % vector of errors
norm(be-beit)
pl help

Antworten (0)

Diese Frage ist geschlossen.

Tags

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by