Warning: Cannot solve symbolically. Returning a numeric approximation instead.
古いコメントを表示
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)
回答 (1 件)
Walter Roberson
2015 年 12 月 21 日
0 投票
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 件のコメント
Walter Roberson
2015 年 12 月 21 日
My tests show that there are an infinite number of solutions near n2 = complex(1.015,1.217)
AdamI120
2015 年 12 月 22 日
Walter Roberson
2015 年 12 月 22 日
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.
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!