Matlab has a built in function linsolve which can be used to solve the system of linear simultaneous equation. linsolve solves the equations Ax = b. Where A is an m-by-n matrix of coefficients, x is an n-by-1 matrix of variables, and b is an m-by-1 matrix of constants. Here is the code snippet to solve the system of linear simultaneous equations using linsolve.
main.m181 chars12 lines
In this code snippet, we defined the coefficient matrix A and constants vector b. Then we solved the equations using linsolve. The solution is stored in the x variable. Finally, we displayed the solution using disp function.
gistlibby LogSnag