0

我知道如何使用 equationstomatrix 函数将线性方程转换为矩阵

syms x y z;
[A, b] = equationsToMatrix([x + y - 2*z == 0, x + y + z == 1, 2*y - z + 5 == 0], [x, y, z])

%solution of the equation set

A =
[ 1, 1, -2]
[ 1, 1,  1]
[ 0, 2, -1]

b =
  0
  1
 -5

不幸的是,equationsToMatrix不能用于非线性方程。如果我想将多个非线性方程转换为矩阵,有没有办法做到这一点?例如,我有三个方程:

 x^2 + y^2+ 1=0,
 x - y + 1=0,
 x^2+xy-2=0,

我想得到以下结果

 A=
   [1, 1,  1, 0,  0, 0 ]
   [0, 0,  1, 1, -1, 0 ]
   [1, 0, -2, 0,  0, 1 ]
4

1 回答 1

0

i had the same problem. the closest solution i could find was to transform the symbolic equations to function handle (@): matlabFunction(a, 'file', 'ODEfunctions',... 'vars', {[v]}); a is my matrix of symbolic expression. and v are the symbolic variables. you get a function that has an input of the names of v but its a numerical function, not symbolic. which you can use with out the matrix. (ofcourse i had the problem solving a set of ODE's)

cheers.

于 2014-02-12T06:34:35.477 回答