Opening the book…
Exercise 1: Vector Basics
Create the vectors A = [2 -1 4] and B = [3 5 -2]. Then calculate A + B, A - B, 4A, dot(A,B), cross(A,B), norm(A), and the unit vector in the direction of A.
Exercise 2: Perpendicular Vectors
Use the dot product to determine whether the vectors [1 2 -1] and [3 -1 1] are perpendicular. Explain your answer in a short comment in your script.
Exercise 3: Special Matrices
Create the matrix M = [4 2 9; 1 5 3; 8 6 7]. Use MATLAB to find the transpose, diagonal values, trace, lower triangular part, and upper triangular part.
Exercise 4: Write Your Own Trace/Diagonal Function
Write a function named matrixTraceDiag.m. The function receives a square matrix and returns two outputs: the diagonal of the matrix and the sum of the elements on the diagonal. Display a proper error message if the matrix is not square.
Exercise 5: Matrix Addition and Multiplication
Create two matrices A and B of compatible sizes. Demonstrate A + B, A - B, A*B, and A.*B where possible. Add comments explaining which operations require matching dimensions and which operations require the matrix multiplication rule.
Exercise 6: Solve a 2 by 2 System
Solve the following system using the backslash operator:
\(3*x1 + 2*x2 = 12\)
-\(4*x1 + 2*x2 = 4\)
Then rewrite the equations as straight lines and plot them to verify the intersection point.
Exercise 7: Change the System
Change the second equation in Exercise 6 to -6*x1 - 4*x2 = -24. Solve the new system and plot the two lines. How many solutions does the system appear to have?
Exercise 8: Four Unknowns
Solve the following system using matrix operations:
\(4*x1 - x2 + 3*x4 = 10\)
\(-2*x1 + 3*x2 + x3 - 5*x4 = -3\)
\(x1 + x2 - x3 + 2*x4 = 2\)
\(3*x1 + 2*x2 - 4*x3 = 4\)
Remember to include zero coefficients for variables that are missing from an equation.
Exercise 9: Engineering Application
A simple force balance produces the following equations for three unknown forces F1, F2, and F3:
\(F1 + 2*F2 - F3 = 10\)
\(2*F1 - F2 + 3*F3 = 25\)
\(-F1 + F2 + F3 = 5\)
Solve for the three forces using MATLAB. Then verify your answer by computing A*F.
This page titled 13.23: Chapter Exercises was last modified on Tue, 30 Jun 2026 02:12:00 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.