MAT 335-001

INSTRUCTIONS TO ADD LAY DATA TO MATLAB

Fall 2007

 

WHY?

 

The author of our textbook, David Lay, has provided data from exercises in the text and some handy commands that can be “loaded” into MATLAB.  They are not part of MATLAB, but they act as if they were after this process is completed.  These are the instructions for loading the data.  This has been done permanently on (most of) the PCs in BR 161, but you must do it manually on other PCs on the UNCW campus network.  Unfortunately, the information is lost after rebooting (except in BR 161), and the procedure must be repeated. 

 

Besides the data for exercises in the textbook, these special commands are only available through this procedure.  They include:

 

replace(M,r,m,s)                         Replaces row r of M by row r + m*row s

swap(M,r,s)                                 Interchanges rows r and s of M

scale(M,r,c)                                 Multiplies row r of M by a nonzero scalar c

gauss(M,r)                                  Uses the leading nonzero entry or row r of M as a pivot and, using only row replacement operations, creates zeros below that pivot

matops                                        Summarizes matrix operation symbols

planelt                                         Starts a program to visualize the effect of 2x2 linear (matrix) transformations

randomint(m,n)                          Produces a random mxn matrix with integer entries

reduce(M)                                   Prompts user for choices of row operations

nulbasis(M)                                (will be used later in the course)

 

 

WHAT TO DO (BRIEF)

 

1.            In MATLAB, set path  bearsrv\Math\spackmank\laydata

2.      Save the path.

 

WHAT TO DO (DETAILED)

 

1.            Open MATLAB by clicking once on START, then MATLAB 7.0.4

2.            From the File drop-down menu in MATLAB, select Set Path…

3.            Click Add with Subfolders…

4.            Scroll down to Classrooms on ‘Bearlabs Classroom Server (bearsrv)’ (Y:) and click +

5.            Click + beside Math, then click + beside spackmank, then click laydata

6.            Click once on OK

7.            Click Save.  Close the window.

 

To test to see if it works, at the prompt in MATLAB, enter c1s1 and hit Enter.  If it asks you to enter an exercise number, you did everything correctly!  If not, try it all again.

 

Other commands that are part of MATLAB:

 

Format rat                                      Displays rational numbers as fractions

Format short                                 Displays four decimal places

Format bank                                 Displays two decimal places

Format long                                  Displays ten decimal places

zeros(n)                                          Displays the nxn matrix of all zeros

ones(n)                                           Displays the nxn matrix of all ones

eye(n)                                              Displays the nxn identity matrix

inv(A)                                              Calculates the inverse of A

rand(m,n)                                        Displays a random mxn matrix in the current format

det(A)                                              Calculates the determinant of the square matrix A

A\b                                                   Uses the LU-factorization method to solve Ax=b

A’                                                     Displays the transpose of A

A(m,n)                                             The entry in row m, column n of matrix A

A(:,i:j)                                              Columns i through j of matrix A