MATLAB 3 equations and 3 unknowns

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

The discussion focuses on solving a system of three equations with three unknowns using MATLAB. The user initially attempted to use matrix division with the syntax A/b, which is incorrect for this purpose. The correct approach is to use the backslash operator A\b, which is equivalent to calculating inv(A)*b. Additionally, the reduced row echelon form can be obtained using rref([A b]) to verify the uniqueness of the solution.

PREREQUISITES
  • Familiarity with MATLAB syntax and operations
  • Understanding of linear algebra concepts, specifically systems of equations
  • Knowledge of matrix operations, including matrix inversion
  • Experience with MATLAB functions such as rref
NEXT STEPS
  • Learn how to implement the backslash operator in MATLAB for solving linear equations
  • Explore the use of the inv() function in MATLAB for matrix inversion
  • Study the rref function in MATLAB to understand reduced row echelon form
  • Investigate the implications of unique vs. non-unique solutions in linear algebra
USEFUL FOR

Students and professionals working with MATLAB who need to solve systems of linear equations, particularly those in engineering or mathematics fields.

Elecomputer
Messages
8
Reaction score
0
Hello,

I have never really used MATLAB before, and I was assigned some homework on it. While I was able to solve most of them, I was unable to solve this one in particular, even after searching the internet and documentation, there was many kinds that I was left confused.

Does anyone know the syntax for this general case:

ax+by+cz=d
ex+fy+gz=h
ix+jy+kz=l (<- awesome I got vector components to match with x,y,z)

And I'd like to solve for x, y, z.

This is what I tried:

A = [a,b,c;e,f,g;i,j,k]
b = [d;h;l]

and then A/b.

This gives me three numbers (in my case, I'm not using letters)

Is this the correct approach?

All help is appreciated.
 
Physics news on Phys.org
Hello,

I think the correct way is A\b , which is equivalent to inv(A)*b.

Have a good day,
J.
 
You could use
Code:
rref([A b])

If there is a unique solution, the answer should be the identity matrix with an extra column on the right, which contains the solutions for x, y, and z.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K