Matlab Homework - You must submit your Matlab code as well.
1. Create a vector of the even whole numbers between 31 and 75.
2. Let x = [2 5 1 6].
a. Add 16 to each element
b. Add 3 to just the odd-index elements
c. Compute the square root of each element
d. Compute the square of each element
3. Given a vector, t = 1:0.2:2, of length n, write down the MATLAB expressions that will correctly compute the following:
a. ln(2 + t + t^2)
b. e^t(1 + cos(3t))
c. cos^2(t) + sin^2(t)
d. tan^(-1)(1) (this is the inverse tangent function)
4. Given x = [3 1 5 7 9 2 6], find the results of the following commands.
a. x(3)
b. x(1:6)
c. x(1:end)
d. sum(x)
5. Given the arrays x = [1 4 8], y = [2 1 5] and A = [3 1 6; 5 2 7], determine which of the following statements will correctly execute and provide the result. If the command will not correctly execute, state why it will not.
a. x + y
b. x + A
c. x' + y
d. A - [x' y']
6. Given the array A = [2 7 9 7; 3 1 5 6; 8 1 2 5], explain the results of the following commands:
a. A'
b. A([2 3],[3 1])
c. A(1:3,:)
d. sum(A)
e. sum(A,2)