solve 4 equations with some unknowns parameters.

17 次查看(过去 30 天)
I'm attempting to solve this problem which is attached. But I faced ERROR. Any suggestions?
  12 个评论
Star Strider
Star Strider 2018-11-2
The ver output disagrees with you:
MATLAB Version 7.11.0.584 (R2010b)
Operating System: Microsoft Windows 7 Version 6.2 (Build 9200)
...
Symbolic Math Toolbox Version 5.5 (R2010b)
...
Skill_s
Skill_s 2018-11-2
Thanks a lot. So, what should I do? Should I run another version of MATLAB?

请先登录,再进行评论。

采纳的回答

Bruno Luong
Bruno Luong 2018-11-3
编辑:Bruno Luong 2018-11-3
Your problem looks like you find the EM field with 3 layers and 2 interfaces. The coefficients A, B, C, D gives the strength of different field components, they are linearly related because EM is linear. In order to solve with without getting trivial solution
A=B=C=D=0
You must for example fix one of them arbitrary, e.g.
A = 1
That left you with 4 linear equations and 3 unknowns. Then in order such system to have solution, you must have the linear system to have dependent equation, meaning determinant of the matrix is 0.
Write it down this probably gives the equation you looks for.
I don't have symbolic tbx to do this kind of calculation to confirm, it would be possible to carry out numerically me think.
  4 个评论
Bruno Luong
Bruno Luong 2018-11-4
Actually solving linear system is not what Skill interested, what he is interested is the the condition under which the 4 linear equation is dependent thus solvable.
This boils down to single equation of determinant. I shows here the solution he gives makes DET(M) = 0.
% Fake k, epsilon 1,2,3
k = rand(1,3);
eps = rand(1,3);
p = k./eps;
% compute solution a
r = ((p(1)+p(2))*(p(1)+p(3)))/((p(1)-p(2))*(p(1)-p(3)));
a = log(r)/(-4*k(1))
% Forming linear matrix
ep = exp(k*a);
em = exp(-k*a);
M = [em(3) 0 -ep(1) -em(1);
p(3)*em(3) 0 p(1)*ep(1) -p(1)*em(1);
0 em(2) -em(1) -ep(1);
0 -p(2)*em(2) p(1)*em(1) -p(1)*ep(1)];
% verifies the 4 x 4 system is rank 3
rank(M)
det(M)
Now if Walter who has access to Symb Tbx can show the opposite, started from
det(M) = 0
shows the solution of it is
r = ((p(1)+p(2))*(p(1)+p(3)))/((p(1)-p(2))*(p(1)-p(3)));
a = log(r)/(-4*k(1))
Then the problem is completely solved.

请先登录,再进行评论。

更多回答(1 个)

Florian Augustin
Florian Augustin 2018-11-2
Hi,
I think you are using a modern syntax to call 'solve' that was not supported in R2010b. The equivalent call in R2010b would be
syms a A B C D eps1 eps2 eps3 k1 k2 k3;
eqn1 = (C*exp(k1*a))+(D*exp(-k1*a))-(A*exp(-k3*a));
eqn2 = ((-(C*k1)/eps1)*exp(k1*a))+(((D*k1)/eps1)*exp(-k1*a))-(((A*k3)/eps3)*exp(-k3*a));
eqn3 = (C*exp(-k1*a))+(D*exp(k1*a))-(B*exp(-k2*a));
eqn4 = ((-(C*k1)/eps1)*exp(-k1*a))+(((D*k1)/eps1)*exp(k1*a))+(((B*k2)/eps2)*exp(-k2*a));
sol = solve(eqn1, eqn2, eqn3, eqn4, A, B, C, D);
ASol = sol.A
BSol = sol.B
CSol = sol.C
DSol = sol.D
You can access the documentation for your release of MATLAB by typing 'doc solve' in the MATLAB interface.
Hope this helps,
-Florian
  7 个评论
Walter Roberson
Walter Roberson 2018-11-2
MATLAB gives all 0.
If you work through the equations one by one doing stepwise elimination, then all 0 is the only solution.

请先登录,再进行评论。

产品


版本

R2010b

Community Treasure Hunt

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

Start Hunting!

Translated by