Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Having problem about matlab code

조회 수: 1 (최근 30일)
Redwood
Redwood 2015년 8월 31일
마감: MATLAB Answer Bot 2021년 8월 20일
Dear Matlab experts,
I would like to get x and y. Here is my coding below. Please solve this problem. Thank you very much in advance.
Sincerley yours,
J1
syms x y
A = 5;
B =10;
C = 6;
D = 3;
sol = solve(x*(1-exp(-y*B))==A, x*(1-exp(-y*D))==C, x, y)
  댓글 수: 1
Stephen23
Stephen23 2015년 8월 31일
@Redwood: I just formatted your code for you, but in future you can do it yourself very easily: select the code and click the {} Code button that you will find above the text box.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 8월 31일
What difficulty are you encountering with that code?
The solutions are algebraically of the form
T = RootOf(6*Z^9 + 6*Z^8 + 6*Z^7 + 6*Z^6 + 6*Z^5 + 6*Z^4 + 6*Z^3 + Z^2 + Z+1, Z)
x = -(26/15)*T^8-(52/15)*T^7+(4/5)*T^6-(14/15)*T^5-(8/3)*T^4+(8/5)*T^3-(2/15)*T^2-(19/45)*T+238/45
y = -ln(T)
where RootOf(f(Z),Z) represents the set of values, Z, such that f(Z) = 0 -- that is, the roots of the expression.
As the polynomial is of order 9, there is no closed form formula for representing the roots. You can represent them by placeholders like this, or you can evaluate them numerically. There are 9 different roots, so there are 9 different solutions for your x and y. 8 of the 9 roots are complex valued and one of them is real valued, but the real-valued root is negative so ln() of it is complex so all of the y are complex. With one of the roots being real-valued, one of the x is real-valued.
I would expect that you are getting back a symbolic result that has the same meaning as the above. You can apply mathematical reasoning to the roots, but they are not very meaningful to humans unless you take their numeric values. You can do that using vpa() or using double()
double(sols.x)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by