MATLAB unable to solve 6 equations :S

  • Context: MATLAB 
  • Thread starter Thread starter sgvaibhav
  • Start date Start date
  • Tags Tags
    Matlab
Click For Summary
SUMMARY

The discussion centers on a MATLAB user encountering issues while solving a system of six equations with six unknowns using the solve function. The user initially defined six symbolic variables (AX, AY, BX, BZ, CY, CZ) but overlooked the declaration of the variable BY, resulting in an underdetermined system. The output revealed dependencies on AY, indicating that the equations were not properly set up. The user concluded that the problem stemmed from the missing variable declaration and the incorrect number of unknowns.

PREREQUISITES
  • Familiarity with MATLAB symbolic math toolbox
  • Understanding of systems of linear equations
  • Knowledge of symbolic variable declaration in MATLAB
  • Basic concepts of engineering mechanics
NEXT STEPS
  • Review MATLAB's syms function for declaring symbolic variables
  • Learn about solving systems of equations in MATLAB using solve
  • Explore techniques for handling underdetermined systems in MATLAB
  • Study the principles of linear algebra relevant to engineering mechanics
USEFUL FOR

Students and professionals in engineering mechanics, MATLAB users solving systems of equations, and anyone troubleshooting symbolic computation issues in MATLAB.

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

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 22 ·
Replies
22
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K