How to solve linear equation

36 visualizaciones (últimos 30 días)
Khandaker Hassin Sadman
Khandaker Hassin Sadman el 8 de Abr. de 2022
Respondida: Ayush Singh el 13 de Jul. de 2022
  2 comentarios
Riccardo Scorretti
Riccardo Scorretti el 8 de Abr. de 2022
Rewrite the linear system by using the matrix formalism Ax = b (you can define A and b in the usual way). Then use the operator \ to compute the solution
Steven Lord
Steven Lord el 8 de Abr. de 2022
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

Iniciar sesión para comentar.

Respuestas (1)

Ayush Singh
Ayush Singh el 13 de Jul. de 2022
Hi Khandaker, from your question I understand you want to solve a system of linear equations.
Firstly declare the system of equations.
syms x y z
eqn1 = 2*x + y + 5*z == 10;
eqn2 = 4*x + 2*y + 5*z == 16;
eqn3 = 3*x + 3*y + 8*z == 7;
Now solve the system of equations using solve. The inputs to solve are a vector of equations, and a vector of variables to solve the equations for.
sol = solve([eqn1, eqn2, eqn3], [x, y, z]);
xSol = sol.x
xSol = 
ySol = sol.y
ySol = 
zSol = sol.z
zSol = 

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by