Question 1: Solve a system of 7 equations. Use tic() and toc() functions to test whether matrix left division is faster or matrix inverse is faster. The notes said that left division was generally more accurate and faster, but in this case the inverse was faster and both gave the same results.
Question 2: This question was similar to the desalination question from the example in class. The most difficult part was figuring out how to solve for the third unknown. It took a few minutes, but I finally realized that the third variable x could be moved to the right-side of the equations. The first equation would have a 0 in place of the coefficient for x.
Question 3: Similar to the truss example from class, but with a force applied at an angle. I just modified the program from class to allow the user to enter the force applied and the angle at which it was applied.
All of the problems could be solved using a generic function ask_matrix(). It asks for the amount of unknowns needed, then uses two while loops to allow the user to enter in the appropriate amount of coefficients. The, the user is prompted to enter the answers to the equations. It will return two matrices, one containing the coefficients, and one containing the answers (which is transposed). I could also have it calculate the unknowns with 1 extra line of code.