how to calculate the value from function define

1 Ansicht (letzte 30 Tage)
shiv gaur
shiv gaur am 16 Feb. 2022
Kommentiert: Walter Roberson am 16 Feb. 2022
la0 = 650; k0 = 2*%pi/la0; ef = 1; ec = -19.6224-0.443*%i; es=ec;
pc = ef/ec; ps = ef/es;
bcinf = sqrt(ec*ef/(ec+ef));
tol = 1e-12;
acut = -real(1/pc/sqrt(ef-ec))/k0;
wc = 2*acut;
nc = sqrt(ef);
w = 5:10:3500; //% thickness range for TM0
w1 = 1.001*wc:10:3500; //% thickness range for TM1
function be=f(la0, ef, ec, w, bcinf, m, tol);
for j=1:length(w)
be(j) = f(la0,ef,ec,w(j),bcinf,0,tol);
end
for j=1:length(w1)
be1(j) = f(la0,ef,ec,w1(j),bcinf,1,tol);
end
neff0 = real(be0); L0 = -1/2./imag(be0)/k0/1000; //% TM0 index & distance
neff1 = real(be1); L1 = -1/2./imag(be1)/k0/1000;// % TM1 index & distance
w2=1000; a = w2/2;// % specific solutions
b = f(la0,ef,ec,a,bcinf,0,tol);// % TM0
p = f(la0,ef,ec,a,bcinf,1,tol);// % TM1
neff02 = real(be02); L02 = -1/2/imag(be02)/k0/1000;
end
disp(be,b,p)
pl help to solve the problem to disp(be,b,p)
  1 Kommentar
Walter Roberson
Walter Roberson am 16 Feb. 2022
Your function f calls itself multiple times, and does so unconditionally. That is an infinite loop.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Stress and Strain finden Sie in Help Center und File Exchange

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