Transcendental equation solution by numerical method

조회 수: 5 (최근 30일)
Rizwan
Rizwan 2013년 11월 18일
답변: Matt J 2013년 11월 18일
Hello,
I want to solve one transcendental equation numerically. I have used the function 'solve' for the solution but my results are varied as compared to graphical solution. My code is written below and I am sending the graphical solution results.
clear all;
n1=1.77;
n2=1.45;
d=1e-6;
lambda = 1e-6;
ko = 2*pi/lambda;
A=(ko*n1)^2;
B=(ko*n2)^2;
r=(ko*d)*sqrt(n1^2-n2^2);
syms h;
s=((h*d)-m*pi) == 2*atan(sqrt(r^2/(h^2*d^2)-1));
solve (s)
prop=sqrt(A-ans^2);
neff=(prop*lambda)/(2*3.14)
where m will be varries from 0 to 2.0 with interval of 0.5. Graphical results are: m=0 neff is 1.7299 but graphical solution is 1.75 m=0.5 neff is 1.678 but graphical solution is 1.71 m=1.0 neff is 1.608 but graphical solution is 1.65 m=1.5 neff is 1.523 but graphical solution is 1.55 m=2.0 neff is 1.451 but graphical solution is 1.452
Can anyone please help me out and tell me the fault ? Also is there any other function can be used instead of 'solve'.
Thanks.

답변 (1개)

Matt J
Matt J 2013년 11월 18일
If you want to solve numerically, you shouldn't be using 'solve'. You should be using fzero or fsolve.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by