Question: 2. Use vectors in scalar calculations. Write single MATLAB statements to perform these operations on vectors, use calculator mode and save your code and results
2. Use vectors in scalar calculations.
Write single MATLAB statements to perform these operations on vectors, use calculator mode and save your code and results to a diary file. Use this vector in the following exercises: x = [0 3 -4 4.5]; Do not change vector x, let all the results go to the default "ans" identifier. One of them produces an error.
A. Subtract 7 from every element of x B. Add .5 to every element of x
C. Multiply every element of x by 2 D. Subtract x from 5 E. Divide 4 by x F. Divide every element of x by -3
3. Accessing vector elements for calculations.
Write single MATLAB statements to perform these operations on vectors, use calculator mode and save your code and results to a diary file. Do not change vector x, let all the results go to the default "ans" identifier.
A. Using the vector x from problem number 2, use the disp() function to display the third element of x. B. Using the vector x from problem number 2, add 10 to the second element of x. C. Sum all the elements of the vector C from problem 1C.
D. Display the last element of the vector E from problem 1E (assume you do not know how many elements are in E).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
