Odd warning bug on MATLAB
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!