leftimage for poohprod.ru

Simultaneous Equations

- Linear Algebra

Solving a system of simultaneous equations is easy in Matlab. It is, maybe, the most used operation in science and engineering, too. Solving a set of equations in linear algebra on a computer is nowadays as basic as doing arithmetic additions using a calculator. Let's see how easy Matlab makes this task.

Go to Video Summary

We'll solve the set of linear equations given below.

To solve these equations, no prior knowledge of matrix algebra or linear methods is required. The first two steps described below are really basic for most people who know just a little bit of linear algebra...

Consider the following set of equations for our example.

-6x = 2y - 2z + 15
4y - 3z = 3x + 13
2x + 4y - 7z = -9

First, rearrange the equations.

Write each equation with all the unknown variables on the left-hand side and all known quantities on the right side. Thus, for the equations given, rearrange them such that all terms involving x, y and z are on the left side of the equal sign.

-6x - 2y + 2z = 15
-3x + 4y - 3z = 13
2x + 4y - 7z = -9

Second, write the equations in a matrix form

To write the equations in the matrix form Ax = b, where x is the vector of unknowns (you have to arrange the unknowns in vector x), the coefficients of the unknowns in matrix A and the constants on the rigth hand of the equations in vector b. In this particualar example, the unknown column vector is

x = [x y z]'

the coefficient matrix is

A = [-6 -2 2
-3 4 -3
2 4 -7]

and the known constant column vector is

b = [15 13 -9]'

Note than the columns of A simply are the coefficients of each unknown from all the three expressed equations. The apostrophe at the end of vectors x and b means that those vectors are column vectors, not row ones (it is Matlab notation).

Third, solve the simultaneous equations in Matlab

Enter the matrix A and vector b, and solve for vector x with the command

x = A\b

(note that the '\' symbol is different from the ordinary division '/' sign).

The Matlab answer to the lines above is:

A =
-6 -2 2
-3 4 -3
2 4 -7

b =

x =

You can test the result by performing the substitution and multiplying Ax to get b, like this:


And the Matlab answer is:

ans =

which corresponds to the column vector b, indeed.

Was this system of equations easy enough?

Video Summary - Solve Linear Systems

From 'Simultaneous Equations' to home

From 'Simultaneous Equations' to 'Linear Algebra Menu'

Table of Contents/Search


Application - Circuit Analysis

Nonlinear Systems

Curve Fitting

footer for simultaneous equations page

Related pages

graphing matlabhow to find node voltagematlab indefinite integralprograms of matlabgraph the piecewise defined functioncreate histogram matlabmatlab solving systems of equationsfourier series sawtooth wavescilab examplebinary decimal numbershow to divide octal numbersscrap value calculatorpascals triangle in cplot matrix in matlabtau rcsum of infinite gp seriesdepreciation salvage valuematlab drawingoctet to decimallagrange interpolation matlabplotting fourier series in matlabcount bmi formulahow to find time constant of rc circuitintergral calculatorgui in matlabbinary to decimal converterstandard deviation normal distribution calculatorstd matlabroot matlabgauss jordan elimination calculator onlinesum of fibonacci sequencelagrange polynomial interpolation matlab codepythag calculator3d graph in matlabmatlab x axis rangehow to graph piecewise functions on calculatorhanoi tower algorithmcontinuously compounding interest calculatorsawtooth wavedecimal to ascii tableinterp1 matlabcalculating half life decayinverse function matlabgauss jordan techniqueheaviside functionsscilab examplesradio button in matlab guigauss jordan inverserc circuit chargingstem in matlab meansleast squares fitting matlabmatlab switch statementhow to calculate square feet with inchesmanually calculate bmilinear algebra in matlabelectricity cost calculator kwhfind roots of quadratic equation calculatorwhat is scrap value in depreciationmatlab axis labelbinary to decimal conversion formulacalculating electricity cost formulamatlab code tutorialoctal codeinterp1 matlabhow to hexadecimal to binarymatlab random number generationhexadecimal conversion tablevertical line matlabbinomial distribution solved problemsmatlab program exampleswhat is salvage value of an asset3dplot matlab3d plot on matlabmatlab programssawtooth harmonics