MATLAB unable to solve 6 equations :S

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

Discussion Overview

The discussion revolves around a user's experience with solving a system of six equations with six unknowns in MATLAB, specifically in the context of engineering mechanics. The user encounters issues with the output of the solve function, which does not yield a proper solution.

Discussion Character

  • Technical explanation, Debate/contested, Homework-related

Main Points Raised

  • The user presents their equations and the output received from MATLAB, expressing confusion over the results.
  • Another participant questions whether a different function should be used instead of solve.
  • One participant points out that there may be seven unknowns instead of six, noting that the variable B_y was not declared initially, which could lead to the unexpected output.
  • The same participant acknowledges their oversight in the number of unknowns and the declaration of B_y, indicating a realization of a potential mistake in their equations.
  • The user humorously mentions that they are not planning to revisit the equations since their exam is over.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the cause of the issue, with some suggesting potential oversights in variable declaration while others question the appropriateness of the solve function.

Contextual Notes

The discussion highlights potential limitations regarding the declaration of variables and the number of equations versus unknowns, which may affect the ability to find a unique solution.

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
3K
  • · 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