Warning: Cannot solve symbolically. Returning a numeric approximation instead.
3 views (last 30 days)
Show older comments
Hello!
I'm trying to use the solve() function to solve a complex equation, but I can't seem to get it right. I keep getting "Warning: Cannot find explicit solution. ". This is my code:
d2=140;
d3=1200;
n3=1.445;
syms n2
ns=3.5;
lambda=600;
k2=n2.*2*pi/lambda;
k3=n3*2*pi/lambda;
delta2 = k2*d2;
delta3 = k3*d3;
M3 = [cos(delta3) (1i)*sin(delta3)/n3;(1i)*n3*sin(delta3) cos(delta3)];
M2 = [cos(delta2) (1i)*sin(delta2)/n2;(1i)*n2*sin(delta2) cos(delta2)];
M=M2*M3;
sub_vector = [1;ns];
sol=M*sub_vector;
r=(sol(1)-sol(2))/(sol(1)+sol(2));
solv = solve((abs(r))^2 == 1000,n2)
0 Comments
Answers (1)
Walter Roberson
on 21 Dec 2015
You are rarely going to get a closed form solution to a trig function, especially one involving floating point values.
My tests suggest that n2 would have to be imaginary for the expression to equal 1000. Are you expecting an imaginary value? (I have not determined yet whether there are any solutions.)
3 Comments
Walter Roberson
on 22 Dec 2015
No chance. If you plot abs(r)^2 over n2 = 2 to 4 you will find that it is strictly less than 1, and so cannot reach 1000. abs(r)^2 varies a fair bit but the upper limit over the real numbers is +1
In order for abs(r)^2 to reach 1000 then n2 needs to be a complex number whose real part is very close to 1.015 (narrow peak). The imaginary portion has a slightly wider range but not much.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!