Numeric solution of a transcendental equation

I need to solve a transcendental equation which would give me a complex result.
I use the function fzero but it requires real and finite starting point and zero of the function.
I define the function for which I want to find the complex zero
function beta1 = trial0(beta, eps1, eps2, epsm,k0,h)
S1 = sqrt(power(beta,2)-(eps1*power(k0,2)));
S2 = sqrt(power(beta,2)-(epsm*power(k0,2)));
S3 = sqrt(power(beta,2)-(eps2*power(k0,2)));
beta1 = tanh(S2*h)*((eps1*eps2*power(S2,2))+(power(epsm,2)*S1*S3)) + (S2*((eps1*S3)+(eps2*S1))*epsm);
end
And in the main program I pass the parameters and call fzero.
eps1 = 1.5471;
eps2 = 1.5431;
eps1m = -9.894 ;
epsm2 = 1.0458;
epsm = eps1m + i*eps2m;
lambda = 633;
k0 = (2*pi)/lambda;
h = 50;
beta0 = fzero(@(beta) trial0(beta, eps1, eps2, epsm,k0,h),0.02)
but since epsm is complex, it doesn't work. How can I solve the equation for various h if epsm is complex? Any help is very much appreciated
Silvia

Respuestas (1)

Matt Fig
Matt Fig el 14 de Abr. de 2011
Please format your code using the {} Code button so that it is readable.
Using the modified version of your function below (modified to accept array arguments):
function beta1 = trial0(beta, eps1, eps2, epsm,k0,h)
S1 = sqrt(power(beta,2)-(eps1.*power(k0,2)));
S2 = sqrt(power(beta,2)-(epsm.*power(k0,2)));
S3 = sqrt(power(beta,2)-(eps2.*power(k0,2)));
beta1 = tanh(S2.*h).*((eps1.*eps2.*power(S2,2))+(power(epsm,2).*S1.*S3)) + (S2.*((eps1.*S3)+(eps2.*S1)).*epsm);
.
Then we can use NEWTZERO
eps1 = 1.5471;
eps2 = 1.5431;
eps1m = -9.894 ;
eps2m = 1.0458;
epsm = eps1m + i*eps2m;
lambda = 633;
k0 = (2*pi)/lambda;
h = 50;
rt = newtzero(@(beta) trial0(beta, eps1, eps2, epsm,k0,h))
rt =
-0.0145022535285521 - 0.000368185024608621i
0.0145022535285521 + 0.000368185024608621i

2 comentarios

shiv gaur
shiv gaur el 14 de Oct. de 2021
not working now
shiv gaur
shiv gaur el 14 de Oct. de 2021
pl find correct program

Iniciar sesión para comentar.

Preguntada:

el 14 de Abr. de 2011

Comentada:

el 14 de Oct. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by