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 simultaneous equations

Subject: solving simultaneous equations

From: Nicole

Date: 6 Oct, 2010 14:14:23

Message: 1 of 4

I'm having a little trouble solving these three equations for 3 unknowns (x,y,z) in MATlab:

F(1)= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
F(2)= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z - 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
F(3)=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z + 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;

I have tried fsolve but with little success. I know this isn't a very tough problem but I'm a little rusty with MATlab. Any help would be appreciated.

Thanks!

Subject: solving simultaneous equations

From: Sean

Date: 6 Oct, 2010 14:37:27

Message: 2 of 4

"Nicole " <nicole.b.normandin@raytheon.com> wrote in message <i8i07u$12r$1@fred.mathworks.com>...
> I'm having a little trouble solving these three equations for 3 unknowns (x,y,z) in MATlab:
>
> F(1)= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
> F(2)= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z - 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
> F(3)=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z + 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;
>
> I have tried fsolve but with little success. I know this isn't a very tough problem but I'm a little rusty with MATlab. Any help would be appreciated.
>
> Thanks!

Do you have the Symbolic Toolbox?

syms x y z

F1= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
F2= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z - 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
F3=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z + 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;

S = solve(F1,F2,F3,x,y,z);
S.x
S.y
S.z

and to view the usable value
double(S.x)
...
Good Luck

Subject: solving simultaneous equations

From: Swasti Khuntia

Date: 21 Sep, 2012 09:27:07

Message: 3 of 4

"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <i8i1j7$3mh$1@fred.mathworks.com>...
> "Nicole " <nicole.b.normandin@raytheon.com> wrote in message <i8i07u$12r$1@fred.mathworks.com>...
> > I'm having a little trouble solving these three equations for 3 unknowns (x,y,z) in MATlab:
> >
> > F(1)= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
> > F(2)= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z - 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
> > F(3)=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z + 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;
> >
> > I have tried fsolve but with little success. I know this isn't a very tough problem but I'm a little rusty with MATlab. Any help would be appreciated.
> >
> > Thanks!
>
> Do you have the Symbolic Toolbox?
>
> syms x y z
>
> F1= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
> F2= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z - 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
> F3=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z + 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;
>
> S = solve(F1,F2,F3,x,y,z);
> S.x
> S.y
> S.z
>
> and to view the usable value
> double(S.x)
> ...
> Good Luck

How to do it without Symbolic Toolbox?

Subject: solving simultaneous equations

From: Steven_Lord

Date: 21 Sep, 2012 13:40:02

Message: 4 of 4



"Swasti Khuntia" <swastigunu@gmail.com> wrote in message
news:k3hbtb$eg6$1@newscl01ah.mathworks.com...
> "Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message
> <i8i1j7$3mh$1@fred.mathworks.com>...
>> "Nicole " <nicole.b.normandin@raytheon.com> wrote in message
>> <i8i07u$12r$1@fred.mathworks.com>...
>> > I'm having a little trouble solving these three equations for 3
>> > unknowns (x,y,z) in MATlab:
>> >
>> > F(1)= 47*y - 2*x + 29*z + 2*x*y - 10*x*z + 12*y*z - 111;
>> > F(2)= 12*y - 2*x + (75*z)/2 + 9*6^(1/2)*z*i + 2*x*y + 12*y*z -
>> > 3*6^(1/2)*x*z*i + 5/2 + (141*6^(1/2)*i)/4 + (21*6^(1/2)*y*i)/2;
>> > F(3)=12*y - 2*x + (75*z)/2 - 9*6^(1/2)*z*i + 2*x*y + 12*y*z +
>> > 3*6^(1/2)*x*z*i + 5/2 - (141*6^(1/2)*i)/4 - (21*6^(1/2)*y*i)/2;

*snip*

> How to do it without Symbolic Toolbox?

Reword the problem into a system of six equations [real(F(1)), imag(F(1)),
etc.] in six unknowns [real(x), imag(x), ...] and FSOLVE may have an easier
time of it.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

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