0

I know how to convert linear equations to matrix by using equationstomatrix function

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

unfortunately,equationsToMatrix can not be used for nonlinear equations. If I want to convert multiple nonlinear equations to matrix, is there any possible way to do this? for example, I have three equations:

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

I want to get following result

 A=
   [1, 1,  1, 0,  0, 0 ]
   [0, 0,  1, 1, -1, 0 ]
   [1, 0, -2, 0,  0, 1 ]
user2874944
  • 1
  • 1
  • 1
  • closest thing I can think of is 'coeffs' [link](http://www.mathworks.com/help/symbolic/coeffs.html), but this doesn't give you quite what you are looking for. Maybe it's possible you could do something with the list of coefficients and the list of terms as in the last example. – andy mcevoy Oct 13 '13 at 04:22

1 Answers1

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.

Ohad
  • 1