필터 지우기
필터 지우기

solve 4 equations with some unknowns parameters.

조회 수: 10 (최근 30일)
Skill_s
Skill_s 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
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
Skill_s
Skill_s 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
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.
Skill_s
Skill_s 2018년 11월 3일
Thanks all...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Unit Conversions에 대해 자세히 알아보기

제품


릴리스

R2010b

Community Treasure Hunt

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

Start Hunting!

Translated by