Assuming you have two equations with two variables:
main.m34 chars3 lines
where a1
, a2
, b1
, b2
, t1
, and t2
are known values (constants) and x
and y
are the unknown variables that need to be solved.
You can represent the above equations in matrix format:
main.m16 chars2 lines
where [A] = [a1 b1; a2 b2]
, [x;y]
is a column vector with the unknown variables [x; y]
, and [T] = [t1; t2]
is a column vector with the known values.
To solve for the unknown variables, you can use the MATLAB backslash operator \
. The backslash operator solves the linear equation [A]*[x;y] = [T]
for [x;y]
.
main.m68 chars6 lines
The variables x
and y
will contain the solutions to the equations.
gistlibby LogSnag