Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving 3 equations 3 unknowns second order

Subject: Solving 3 equations 3 unknowns second order

From: Sia

Date: 30 Nov, 2012 23:59:08

Message: 1 of 3

Hello every one.
I have the following equations. how can solve them with Matlab?

X-a*(Y+Z)=0

b*Y^2+c*X^2=d

e*Z^2+f*X^2=g

Is there any one who can give me a hand in the case?

Thanks.

Subject: Solving 3 equations 3 unknowns second order

From: Nasser M. Abbasi

Date: 1 Dec, 2012 01:29:06

Message: 2 of 3

On 11/30/2012 5:59 PM, Sia wrote:
> Hello every one.
> I have the following equations. how can solve them with Matlab?
>
> X-a*(Y+Z)=0
>
> b*Y^2+c*X^2=d
>
> e*Z^2+f*X^2=g
>
> Is there any one who can give me a hand in the case?
>
> Thanks.
>

-------------------------
syms X Y Z a b c d e f g
eq1 = X-a*(Y+Z)
eq2 = b*Y^2+c*X^2-d
eq3 = e*Z^2+f*X^2-g
sol = solve(eq1,eq2,eq3,X,Y,Z)
--------------------

EDU>> sol.X
   
   (b^2*e^2*((b^2*e*g + 2*a^2*b*f*(b*d*e*g - a^2*d^2*e*f -
<SNIP>

etc...

--Nasser

Subject: Solving 3 equations 3 unknowns second order

From: Roger Stafford

Date: 1 Dec, 2012 01:50:14

Message: 3 of 3

"Sia" wrote in message <k9bh8c$13k$1@newscl01ah.mathworks.com>...
> X-a*(Y+Z)=0
> b*Y^2+c*X^2=d
> e*Z^2+f*X^2=g
- - - - - - - - -
  Have you tried 'solve' in the Symbolic Toolbox?

  If that doesn't give you a satisfactory answer, substitute X = a*(Y+Z) into the other two equations to get:

 (b+c*a^2)*Y^2 + 2*c*a^2*Y*Z + c*a^2*Z^2 = d
 f*a^2*Y^2 + 2*f*a^2*Y*Z + (e+f*a^2)*Z^2 = g

Then combine these so as to eliminate the Y^2 term and get an equation involving only Y*Z and Z^2, which can then be solved for Y in terms of Z. If this is substituted for Y in one of the above two equations, you will get a single equation in Z alone, which can be manipulated to a fourth order polynomial equation in Z.

  Fourth order polynomial equations do have explicit solutions but the Symbolic Toolbox is not likely to give them to you. However you can use 'roots' to obtain four numerical Z roots for each set of specified parameters a, b, ..., f. Each of these can then be used to directly find Y and X from the above equations of Y in terms of Z and X in terms of Y and Z.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us