SOLVE command with SYMS

1 回表示 (過去 30 日間)
Eric Hong
Eric Hong 2012 年 9 月 6 日
Hi,
I have the Symbolic Math Toolbox. However, I can't even perform the following operation, which is copied and pasted from the Mathworks website on the usage of Symbolic Math Toolbx.
syms x
solve(x^2 + 4*x + 1 == 0)
The error says the following:
??? Input argument "x0" is undefined.
Error in ==> solve at 56
x=x0;
This isn't really what I'm trying to do. I have a system of non-linear equations and I get a whole different error messages, but the fact that I can't even perform a simple solving operation such as the above makes me think that there's something fundamentally wrong.
Can you please help me?
Thanks,
Eric
  3 件のコメント
Eric Hong
Eric Hong 2012 年 9 月 6 日
編集済み: Eric Hong 2012 年 9 月 6 日
Yes, I think it is the version issue. I have 7.12.0 (R2011a).
I did have a script with the same name 'solve. m'
I removed it from the path and now it says:
>> which -all solve C:\Program Files\MATLAB\R2011a\toolbox\symbolic\symbolic\solve.m
Now I have a different error message:
??? Error using ==> char
Conversion to char from logical is not possible.
Error in ==> solve>getEqns at 189
vc = char(v);
Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
But now the same operation without the logical equal sign now works.
Thanks,
Eric
Walter Roberson
Walter Roberson 2012 年 9 月 6 日
Using the == in that context was not yet allowed in R2011a.

サインインしてコメントする。

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
編集済み: Azzi Abdelmalek 2012 年 9 月 6 日
syms x
solve(x^2 + 4*x + 1)
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
to solve x^2 + 4*x + 1=5*x+1
solve(x^2 + 4*x + 1-(5*x+1))
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 9 月 6 日
編集済み: Azzi Abdelmalek 2012 年 9 月 6 日
or you don't need to use syms variables
solve('x^2 + 4*x + 1=0')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by