MATLAB Answers

solve 4 equations with some unknowns parameters.

11 ビュー (過去 30 日間)
Skill93 2018 年 11 月 2 日
コメント済み: Bruno Luong 2018 年 11 月 4 日
I'm attempting to solve this problem which is attached. But I faced ERROR. Any suggestions?

  12 件のコメント

表示 9 件の古いコメント
Skill93 2018 年 11 月 2 日
Thnks all the version of my windows is 10. Is it related to the version of windows?
Star Strider
Star Strider 2018 年 11 月 2 日
The ver output disagrees with you:
MATLAB Version (R2010b)
Operating System: Microsoft Windows 7 Version 6.2 (Build 9200)
Symbolic Math Toolbox Version 5.5 (R2010b)
Skill93 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
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 件のコメント

表示 1 件の古いコメント
Walter Roberson
Walter Roberson 2018 年 11 月 3 日
If you solve the first three equations for B, C, D, then you are left with
-A*(-(eps1*k3+eps3*k1)*(eps1*k2+eps2*k1)*exp(a*(2*k1-k3))+exp(-a*(2*k1+k3))*(-eps1*k3+eps3*k1)*(-eps1*k2+eps2*k1))/(2*eps3*k1*eps2*eps1) == 0
The obvious solution is A == 0, which then causes B, C, D to all be 0. If, on the other hand, (-(eps1*k3+eps3*k1)*(eps1*k2+eps2*k1)*exp(a*(2*k1-k3))+exp(-a*(2*k1+k3))*(-eps1*k3+eps3*k1)*(-eps1*k2+eps2*k1))/(2*eps3*k1*eps2*eps1) can be 0, then the equations would hold for all finite A, in which case there would be a family of solutions
B = A*((eps1*k3+eps3*k1)*exp(4*a*k1)+eps3*k1-eps1*k3)*exp(-a*(2*k1-k2+k3))/(2*eps3*k1)
C = -A*(eps1*k3-eps3*k1)*exp(-a*(k1+k3))/(2*eps3*k1)
D = A*(eps1*k3+eps3*k1)*exp(a*(k1-k3))/(2*eps3*k1)
which are linear in A.
Skill93 2018 年 11 月 4 日
Thanks a lot. @ Walter Roberson. thnks
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
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 日
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,

  7 件のコメント

表示 4 件の古いコメント
Stephan 2018 年 11 月 2 日
Executing your code in 2018b gives the same result. So you need a better approach.
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.
Skill93 2018 年 11 月 3 日
Thanks all...





Community Treasure Hunt

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

Start Hunting!

Translated by