Each of the problems below is intended to be solved by generating a script or m-file. Be sure to have a very clearly written header for each M-file so that anyone reading your work can decipher the sort of problems you are solving in each M-file. Also, be sure to label all axes and assign each plot a title.

A complete set of m-file solutions can be found here. Of course, your work does not have to look exactly like these scripts but the results (e.g. plots) should look much the same. Dont be lazy and start by looking at these answers only refer to these solutions if you get stuck or want to check your finished work.

  1. Read the HELP pages on the following functions (either by typing "help" and then the function name at the MATLAB command prompt, or by clicking these links): size, det, slash, eye, diag, inv, diary, rand

    Turn in all of Problem #2 as a single M-file. When you are asked to perform a matrix opertion, your M-file should output the results to the screen. Now, you can use the DIARY command to log all the results of your calculations. Some of the things you're asked to do here aren't going to work! When you turn your diary logfile besure to explain why these particular operations resulted in errors.

    Submit a single M-file and one diary logfile.
  2. Given the following matrices:

     
    ab_mats.gif (1121 bytes)
    1. Using the colon operator, create a matrix C1 with the last two rows of A.
    2. Using the colon operator, create a matrix C2 with rows 1, 2, and 3 and columns 3 and 4 of matrix A.
    3. Using the colon operator, create a matrix C3 with columns 2 and 3 of A.
    4. Form a matrix C4 by placing C3 and B side by side.
    5. Find the product of A23 and B32.
    6. Find the product of matrices A and B.
    7. Find the product of matrices B and A.
    8. Find the inverse of matrix A.
    9. Find the inverse of matrix B.
    10. Transpose matrix A (i.e., Find AT).
    11. Transpose matrix B (i.e., Find BT).
    12. Find the product of matrices AT and BT.
    13. Find the product of matrices  BT and AT.
    14. Find the diagonal of matrix A.


For problems #3 and 4 we are going to begin with a graphical interpretaion of solving a system of simultaneous equations. Submit a single M-file and a single plot. Click here to see what your resulting plot should look like.

  1. Plot the following two equations on the same graph:  1.0X0 = 1.0X1 + 0 and 1.0X0 = -1.0X1 + 1.0, where variable X1 goes from -5.0 to +5.0 in steps of 0.01. N.B. These are just linear equations of the form Y = MX + b. Where do these graphs intersect?
  2. Now, express these two equations in standard matrix form. That is Ax = b where A is the coefficient matrix, x is the variable matrix and b is the solution matrix. Solve for x by using both matrix division and the inverse (inv) command. What are the resulting values and what do they mean interms of our previous graph?


    For problems #5 and 6 we are going to begin with a graphical interpretaion of solving a system of simultaneous equations. Submit a single M-file and two plots along with your explanations and interpretaions of the problem. Click here to see what your resulting plots should look like.
  3. Now, use the following A, x and b matrices:

    axb_1.gif (629 bytes)

    First, solve for the vector x and then plot out the graphs corresponding to these two equations. What is the relationship between the graphs and the matrix solution?
  4. Now, use the following A, x and b matrices:

    axb_2.gif (629 bytes)

    First, solve for the vector x and then plot out the graphs corresponding to these two equations. What is the relationship between the graphs and the matrix solution? Did you have troubles coming up with a solution for the matrix? Explain why in terms of the graph that you've generated for this problem.


    For problems #7-10 we are going to use Matlab to perform some standard matrix operations. Here, generate an M-file to perform all of these operations. When you are asked to perform a matrix opertion, your M-file should output the results to the screen. Now, you can use the DIARY command to log all the results of your calculations. Submit a single M-file and one diary logfile.

  5. A.

2X1

-

2X2

+

X3

=

2.5

-2X1

+

3X2

+

2X3

=

-5.1

-X1

+

2X2

+

X3

=

0.2

8.   
B.

3X1

-

2X2

+

7X3

+

X4

=

-7.9

-4X1

-

0X2

-

1.7X3

+

2.2X4

=

6.95

X1

+

3.2X2

+

6X3

+

0.8X4

=

14.0

0.5X1

-

1.6X2

-

10X3

+

4X4

=

32.1

9.     

  1. Using both coefficient matrices from the problem above calculate the following:
    1. The square of each matrix.
    2. The matrix that results when each element is raised to the third power.
    3. The product of the transpose and the inverse of each coefficient matrix.
    4. The square root of the absolute value of each values in both coefficient matrices.
  2. Generate a 5 x 5 matrix of random numbers and call it A.
    1. What is the result of A divided by A?
    2. What is the result of the matrix multiplication of A and the inverse of A?
    3. The results of these two problems produce a "special" matrix with what name?
  3. Generate a 5 x 5 idenity matrix and call it I.
    1. What is the result of an element by element multiplication of A and I? What is this called and what is another, much simpler way to generate this matrix?
    2. What is the result of the matrix multiplication of A and I?

To continue on to the next core lesson, click here.