Question
Using MatLab:
I. (MATLAB) Now use the functions swap, replace and scale to do the same row operations on the same matrices as in question1. One possible solution for exercise is shown, to illustrate how the functions work. Try the example: type each command line shown, press [Enterl, and verify the result. The first line create the matrix, and the second line makes a copy of it. (It's a good idea to work on a copy so if you decide to start over, the original matrix is still in your workspace.) M-[0369;-11-2-1]; 11-2-1 0 369 A swap A, 1,2) A = scale A, 2,1/3 ) 012 3 -1 044 A replacel A, 1,-1,2) A - scalel A, 1,-1) 0123 Now you use these functions to reduce the matrices in Question 0. Record each line you type, and the resulting matris, To learn more about the functions, see Lay's Student Study Guide, or type help swap, help replace, help scale .)
Explanation / Answer
SWAP: this MATLAB function acually swaps the particular row with another specified row:
like A= swap( A, 1,2) ;
this command in matlab will swap the row 1st with row 2.
SCALE: his MATLAB function acually scales the particular entire row with specified scaling number.
:like A= scale( A, 2,1/3) ;
this command in matlab will scale 2nd row with scaling factor 1/3. initial row is { 0, 3,6,9} and after scaling result is {0,1,2,3} in row 2nd.
REPLACE: A= replace(A, 1, -1, 2)
this means row 1st is replaced by (row 1st added to -1 times row 2nd )
R1= R1 + (-1*R2)