Odd warning bug on MATLAB

조회 수: 2 (최근 30일)
SooShiant
SooShiant 2015년 9월 25일
답변: Walter Roberson 2015년 9월 25일
Hi
Yesterday I installed MATLAB and try to solve an equation using this command:
solve('(L*Y*X*D)+(K*(S-A))+(F*X*T)-(F*(H-X)*T)=N','X')
and MATLAB answered me:
((N + K*(A - S) + F*H*T)/(2*F*T + D*L*Y))
I copied both question and answer to a text document and repeated this process for several times to ensure the result is OK. I mean copy-pasted this process for several times.
Then I tried a very big equation (20 lines with 50 variables) and MATLAB answered it too in a second.
Now today I tried those equations using copy-past and do the same way but MATLAB oddly says:
>> solve('(L*Y*X*D)+(K*(S-A))+(F*X*T)-(F*(H-X)*T)=N', 'X')
Warning: Explicit solution could not be found.
> In solve at 179
ans =
[ empty sym ]
How to fix this bug?
thanks for help

채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 25일
solve('(L*Y*X*D)+(K*(S-A))+(F*X*T)-(F*(H-X)*T)=N', 'X')
is equivalent to
solve(sym('(L*Y*X*D)+(K*(S-A))+(F*X*T)-(F*(H-X)*T)=N'), sym('X'))
so (L*Y*X*D)+(K*(S-A))+(F*X*T)-(F*(H-X)*T)=N would get evaluated as a symbolic expression inside the symbolic engine. The result of that is going to depend upon whether you have accidentally told the symbolic engine to define some of those names already.
For example,
syms X(V)
would define X as a function, and then the meaning of X as being a function would be inherited when you did the solve() of a string. And that could fail due to difficulties in solving with respect to a function.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by