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

답변 (1개)

Matt Fig
Matt Fig 2011년 4월 14일

0 개 추천

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

shiv gaur
shiv gaur 2021년 10월 14일
not working now
shiv gaur
shiv gaur 2021년 10월 14일
pl find correct program

댓글을 달려면 로그인하십시오.

카테고리

질문:

2011년 4월 14일

댓글:

2021년 10월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by