Undefined function 'minus' for input arguments of type 'sym'

1 次查看(过去 30 天)
This is my first time with the Symbolic Math Toolbox, 2012b. The following code
syms x y
[sol_x, sol_y] = solve(x^2 + y == 1, x - 2*y^2 == 2)
produces the error
Undefined function 'plus' for input arguments of type 'sym'.
What am I doing wrong? There were a lot of threads on roughly this subject, but I couldn't find one where the answer applied to my situation.
Thanks, Kurt

采纳的回答

Star Strider
Star Strider 2014-3-4
There could be version differences between 2012a and 2013b (that I’m running here). (I don’t have access to 2012a any more, so I can’t test your code with it.)
Your code works fine for me as you posted it, and produces:
sol_x =
- 1.0997213367630765988805181024643 + 0.56837679138702087076241385221614*i
- 1.0997213367630765988805181024643 - 0.56837679138702087076241385221614*i
1.0997213367630765988805181024643 + 0.30938949574368425547005924661781*i
1.0997213367630765988805181024643 - 0.30938949574368425547005924661781*i
sol_y =
0.11366515845543691213299333209121 + 1.2501121696184858278179094827946*i
0.11366515845543691213299333209121 - 1.2501121696184858278179094827946*i
- 0.11366515845543691213299333209121 - 0.68048445967939729425829595210914*i
- 0.11366515845543691213299333209121 + 0.68048445967939729425829595210914*i
  4 个评论
Kurt
Kurt 2014-3-5
Thanks. "solve" wasn't shadowed. It turns out that I needed to have the equations in single quotes for 2012b. Then it worked!
Star Strider
Star Strider 2014-3-5
My pleasure!
I remember that there were version changes, but I couldn’t remember what the syntax was in 2012b.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by