我怎样才能解决超越方程?

时间:2013-11-04 14:39:06

标签: matlab

我想在matlab中解决给定的方程式,以找到beta的值,但会得到错误。我在下面发布代码和错误。

提前致谢。

n1=1.77;
n2=1.45;
d=1e-6;
lambda = 1e-6;
ko = 2*pi/lambda;
A=(ko*n1)^2;
B=(ko*n2)^2;
syms beta;
s = 'sqrt(A-beta^2)*(d/2)*tan(sqrt(A-beta^2)*d/2)=sqrt(beta^2-B)*(d/2)';
solve (s);

错误:

Error using solve>processString (line 337)
' sqrt(A-beta^2)*(d/2)*tan(sqrt(A-beta^2)*d/2)=sqrt(beta^2-B)*(d/2) ' is not a valid expression or equation.

Error in solve>getEqns (line 267)
   eqns = processString(eqns, v, vc);

Error in solve (line 150)
   [eqns,vars,options] = getEqns(varargin{:});

Error in transcendetal (line 9)
   solve (s); 

1 个答案:

答案 0 :(得分:1)

我在R2013a上确认了以下工作:

syms beta A B d

n1=1.77;
n2=1.45;
d=1e-6;
lambda = 1e-6;
ko = 2*pi/lambda;
A=(ko*n1)^2;
B=(ko*n2)^2;

solve ( sqrt(A-beta^2)*(d/2)*tan(sqrt(A-beta^2)*d/2)==sqrt(beta^2-B)*(d/2))

然而,

Warning: Explicit solution could not be found.
> In solve at 179
ans =
[ empty sym ]

这很奇怪,因为在R2010a中使用了#39; old'你上面给出的语法,我得到了

ans =
                                                                                                   0
 -(log((A + B - 2*beta^2 + 2*(A - beta^2)^(1/2)*(beta^2 - B)^(1/2)*i)/(A - B))*i)/(A - beta^2)^(1/2)

请注意,最后一个解决方案是复值的,可能是您必须在以后的版本中启用的一些选项...我不太了解符号数学工具箱;我还是喜欢白板方法:p