MATLAB MATLAB unable to solve 6 equations :S

  • Thread starter Thread starter sgvaibhav
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The user is attempting to solve a system of six equations with six unknowns in MATLAB but is encountering issues with the output not providing proper solutions. They realize that they have inadvertently included seven unknowns by not declaring one variable (BY) in their initial symbolic declaration. This oversight likely contributes to the problems experienced with the solve function. The user acknowledges their mistake and expresses relief that their exam for engineering mechanics is over, indicating they won't revisit the equations for corrections. The discussion highlights the importance of correctly defining all variables in MATLAB to ensure accurate solutions.
sgvaibhav
Messages
65
Reaction score
0
Hi,
I was solving questions on engineering mechanics
I came up with 6 equations and 6 unkowns

I used the solve function, but its not giving me the proper answer (it works very will with 3 unknowns and 3 equations)

This is my input

syms AX AY BX BZ CY CZ
Fx = sym('AX + BY = -125');
Fy = sym('AY + CY = 59');
Fz = sym('BZ + CZ = 388.87');

Mx = sym('-0.3*BZ - 0.4*AY = -212.2');
My = sym('0.5*CZ + 0.4*AX = 0');
Mz = sym('-0.5*CY + 0.3*BX + 0.5*AX = 0');

[AX,AY,BX,BZ,CY,CZ] = solve(Fx,Fy,Fz,Mx,My,Mz)
_____________________________________________________________
This is my output

AX =

398.07916666666666666666666666667-1.6666666666666666666666666666667*AY



AY =

1.1111111111111111111111111111111*AY-565.13194444444444444444444444444



BX =

-523.07916666666666666666666666667+1.6666666666666666666666666666667*AY



BZ =

-1.3333333333333333333333333333333*AY+707.33333333333333333333333333333



CY =

-1.*AY+59.



CZ =

-318.46333333333333333333333333333+1.3333333333333333333333333333333*AY

___________________________________
How is that happening?
 
Physics news on Phys.org
or is it that some other function has to be used other than solve?
 
6 equations and 7 unknowns? You don't declare B_y in your initial syms statement, but it probably gets declared when it's used below. Maybe the coffee hasn't kicked in for me yet so feel free to tell me I'm an idiot :D, but that's what pops out to me right now.
 
Cvan said:
6 equations and 7 unknowns? You don't declare B_y in your initial syms statement, but it probably gets declared when it's used below. Maybe the coffee hasn't kicked in for me yet so feel free to tell me I'm an idiot :D, but that's what pops out to me right now.

oops i just realized i have 7 unknowns :S :S :S
and also that i forgot to declare BY.
something wrong with the equations...

lol, my exam is over for engineering mechanics :P, I am not going back to check for the correct stuff now.
 

Similar threads

Back
Top