Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.