Transcendental equation solution by numerical method
8 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Matt J
on 18 Nov 2013
If you want to solve numerically, you shouldn't be using 'solve'. You should be using fzero or fsolve.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!