using "solve" and getting rid of arbitrary parameters - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

using "solve" and getting rid of arbitrary parameters

math8math8 Posts: 2Member


I am trying to solve a system of equations whose answer will depend on arbitrary values.

For example, consider the following system of 2 equations and 3 unknowns:

[code]syms x1 x2 x3
E=[x1+2*x2+x3;x3-x1+x2];
a=solve(E==0,x1,x2,x3)
A=[a.x1 a.x2 a.x3][/code]

this gives me an answer that depends on an arbitrary value z. (infinitely many solutions).

I would like MATLAB to directly give me an answer (with no arbitrary values). So for instance, I would like to get an answer where the x1 value is positive. Is there a way to do that?

I am using "solve" in a subroutine, and after that, I would like to test the answer to see if it is a non negative array. But whenever the code reaches the answer, it tells me there is an error (obviously) because of the unknown parameter.
Sign In or Register to comment.