25.08.2021 Views

082-Engineering-Mathematics-Anthony-Croft-Robert-Davison-Martin-Hargreaves-James-Flint-Edisi-5-2017

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

320 Chapter 8 Matrix algebra

where

⎛ ⎞ ⎛ ⎞ ⎛ ⎞

3 2−1 4 x

A = ⎝2−1 2⎠ B = ⎝10⎠ X = ⎝y⎠

1−3−4 5 z

Inordertosolvetheseequationsinatechnicalcomputinglanguagethematricesneedto

be loaded into memory. InMATLAB ® wewould type

A = [3,2,−1;2,−1,2;1,−3,−4]

B = [4;10;5]

We note that commas are used to separate entries on the same row and semicolons are

used toseparate different rows.

ThevalueofX canbeobtainedbythemethodofmatrixinversion.Thecodeforthisis

X =inv(A) ∗B

Alternatively,X can be obtained by Gaussian elimination. The code for thisis

X=A\B

Gaussian elimination is the usual method of solving systems of linear equations in

MATLAB ® because it is computationally efficient. If we run this three-line program

using MATLAB ® then weobtain

A = [3,2,−1;2,−1,2;1,−3,−4]

B = [4;10;5]

X=A\B

X = 3.0000

−2.0000

1.0000

and sox = 3.0000, y = −2.0000, z = 1.0000.

We see that MATLAB ® is a powerful tool for carrying out matrix calculations. Part

ofitspowerderivesfromtheextremelyhigh-levelnatureofitscommands.Acommand

suchasinv(A)wouldrequiretypically50linesifwritteninanormalhigh-levellanguage

such as Cor FORTRAN.

Engineeringapplication8.6

SolutionofanelectricalnetworkusingMATLAB®

Consider again the electrical network of Engineering application 8.3. Write the

MATLAB ® code tosolve thisnetwork.

Solution

TheequationsareoftheformV =RI ′ whereV isthevoltagevectorofthenetwork,

RisthematrixofresistorvaluesandI ′ isthecurrentvectorofthenetwork.Weknow

V andRand we wish to obtainI ′ . Using the values of Engineering application 8.3

wecan write

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!