This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Drexel University  ENGR 231 Linear Engineering Systems Copyright 2011 Drexel University Page 1 Lab 2: Matrix Manipulation and Elementary Row Reduction Oleh Tretiak and Donald Bucci Goals for Lab 2: 1. Basic Matrix Manipulation Techniques 2. Manual Row Reduction and the RREF Function Prelab Exercise – Manual and Automated Row Reduction Part 1 – Introduction and Motivation One of the key functionalities of MATLAB is its ability to efficiently handle vector and matrix operations. In this lab, we introduce basic matrix manipulation techniques through the conversion of a system into reduced row echelon form (RREF) . Let’s consider row reduction of the following system of linear equations: x 1 + 2 x 2 + 3 x 3 = 4 4 x 1 + 5 x 2 + 6 x 3 = 7 6 x 1 + 7 x 2 + 8 x 3 = 9 We can rewrite this as an augmented matrix , resulting in: 1 2 3 4 4 5 6 7 6 7 8 9 ! " # # # # $ % & & & & Our goal is to row reduce the above system in an attempt to find its solution set. Recall that this can be obtained by performing elementary row operations until the system is first in echelon form or triangular form (i.e. all entries in a column below leading entries are zero). This may, in some cases, look like the following: # # # # # # # # # ! " # # # # $ % & & & & Once arriving at echelon form, we can continue to the RREF (i.e. the leading entry in each row is equal to one and is the only nonzero entry in each column). This may also, in some cases, look like the following: 1 # 1 # 1 # ! " # # # # $ % & & & & We now show how to perform these operations in MATLAB. Drexel University  ENGR 231 Linear Engineering Systems Copyright 2011 Drexel University Page 2 Part 2 – Performing the Operations in MATLAB Firstly, we need to define a MATLAB varia ble for the augmented matrix. This is done with the following statement: myMatrix = [1 2 3 4; 4 5 6 7; 6 7 8 9] This is another version of the bracket statement that we used in the first lab. Notice that matrix generation within MATLAB is handled one row at a time. The first row is made by using spaces (or commas) to delineate sequential terms. Once a row is completed, a semicolon signifies the beginning of another row, and so on. For ease of explanation, let’s define any position within the matrix as ( r,c ), where r and c represents the row and column indices of the specified matrix element. Our next step is to make locations (2,1) and (3,1) each equal to zero. This may be accomplished by performing the following elementary row operations: STEP 1. R 2 ←4R 1 + R 2 STEP 2. R 3 ←6R 1 + R 3 We thus need to know how to select an entire row out of a variable in MATLAB. To do this, we use the following syntax: variableName(row#,:) where row # delineates the selected row within the matrix defined in the variable whose name is variableName . Thus, the commands that perform the above two steps are as follows: myMatrix(2,:) =  4*myMatix(1,:) + myMatix(2,:) myMatrix(3,:) =  6*myMatix(1,:) + myMatix(3,:) The effect of these two statements is to produce the following matrix:...
View
Full
Document
This note was uploaded on 11/11/2011 for the course ENGR 231 taught by Professor Olehtretiak during the Fall '10 term at Drexel.
 Fall '10
 OlehTretiak

Click to edit the document details