From: Marcus on 12 Apr 2010 06:33 Hello, I have 5 linear (very long) equations and want to transform them into a more conveniently matrix form: A*x=b. How can I do that with Matlab? The equations are too long, to do this by hand. Thank you for your help!
From: Marcus on 12 Apr 2010 06:37 Hello, I have 5 linear (very long) equations (with symbolic variables) and want to transform them into a more conveniently matrix form: A*x=b. How can I do that with Matlab? The equations are too long, to do this by hand. Thank you for your help!
From: Marcus on 12 Apr 2010 11:31 Does anybody know an answer?
From: Walter Roberson on 12 Apr 2010 17:31 Marcus wrote: > Hello, > > I have 5 linear (very long) equations (with symbolic variables) and want > to transform them into a more conveniently matrix form: A*x=b. > > How can I do that with Matlab? The equations are too long, to do this by > hand. Something like this: Vars = {sym('X1'), sym('X2'), sym('X3'), sym('X4'), sym('X5')}; for K = 1:5 b[K] = - coeff(EQNS[K], Vars{K}, 0); A[K] = coeff(EQNS[K], Vars{K}, 1); X[K] = Vars{K}; end This would need adjustment if you are expecting x to be a matrix instead of a vector -- but if you wanted that, you would have to specify how you want your basis vectors to be generated.
|
Pages: 1 Prev: Equations depicting 2 DOF Next: To find X at which Y is maximum |