Engineering Fundamentals: An Introduction to Engineering, 4th ed.c

(Steven Felgate) #1

494 Chapter 15 MATLAB


Solutions of Simultaneous Linear Equations


In this section, we will show how you can use MATLAB’s symbolic solvers to obtain solutions
to a set of linear equations.

Example 15.8 Consider the following three linear equations with three unknowns:x,y, andz.


In MATLAB, the solvecommand is used to obtain solutions to symbolic algebraic equations.
The basic form of the solve command is solve('eqn1','eqn2',

... ,'eqn'). As shown below, we define each equation first and then use the solve
command to obtain the solution.


>>equation_1 = '2*x+y+z=13';
>>equation_2 = '3*x+2*y+4*z=32';
>>equation_3 = '5*x-y+3*z=17';
>>[x,y,z] = solve(equation_1,equation_2,equation_3)

5 xy 3 z 17


3 x 2 y 4 z 32


2 xyz 13


■Figure 15.28 The ezplotfor Example 15.7; see the last row in Table 15.14.


Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).

圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀圀圀圀⸀夀䄀娀䐀䄀一倀刀䔀匀匀⸀䌀伀䴀

Free download pdf