Concept explainers
Write the MATLAB code necessary to create the variables in (a) through (d) or calculate the vector computations in (e) through (q). If a calculation is not possible, explain why. You may assume that the variables created in parts (a) through (d) are available for the remaining computations in parts (e) through (q). For parts (e) through (q) when it is possible, determine the expected result of each computation by hand.
a. Save vector [3 –2 5] in va
b. Save vector
c. Save vector [9 –4 6 –5] in vc.
d. Save vector
e. Convert vd to a row vector and store in variable ve.
f. Place the sum of the elements in Va in the variable S1.
g. Place the product of the last three elements of vd in the variable P1.
h. Place the cosines of the elements of vb in the variable c1. Assume the values in vb are angles in radians.
i. Create a new 14-element row vector V19 that contains all of the elements of the four original
j. Create a two-element row vector v2 that contains the product of the first two elements of vc as the first element and the product of the last two elements of vc as the second element.
k. Create a two-element column vector v2A that contains the sum of the odd-numbered elements of vc as the first element and the sum of the even-numbered elements of vc as the second element.
l. Create a row vector ES1 that contains the element-wise sum of the corresponding values in vc and vd.
m. Create a row vector DS9 that contains the element-wise sum of the elements of vc with the square roots of the corresponding elements of vd.
n. Create a column vector EP1 that contains the element-wise product of the corresponding values in va and vb.
o. Create a row vector ES2 that contains the element-wise sum of the elements in vb with the last three elements in vd.
p. Create a variable s2 that contains the sum of the second elements from all four original vectors, Va, vb, vc, and vd.
q. Delete the third element of vd, leaving the resulting three-element vector in vd.
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
- Use MATLAB please send code for this.arrow_forwardQuestion: For The Given 4-DOF Robot: A. Assign Appropriate Frames For The Denavit-... For the given 4-DOF robot: a. Assign appropriate frames for the Denavit-Hartenberg representation. b. Fill out the parameters table. c. Write an equation in terms of A matrices that shows how UTH can be calculated. U # d. a a A1 0-1 A2 1-2 Аз 2 -3 A4 3- Harrow_forwardWe have designed a divide-and-conquer algorithm that runs on an input of size n. This algorithm works by spending O(1) time splitting the problem in half, then does a recursive call on each half, then spends O(n2 ) time combining the solutions to the recursive calls. On small inputs, the algorithm takes a constant amount of time. We want to see how long this algorithm takes, in terms of n to perform the task. (a) First, write a recurrence relation that corresponds to the time-complexity of the above divide and conquer algorithm. (b) Then, solve the relation to come with the worst-case time taken for the algorithm. Please show all work in depth.arrow_forward
- Q2// Write a MATLAB program that returns the plot of the 2-D space defined by the following equation: Label the x-axis, y-axis, legend, and title to the curve.arrow_forwardQ3: Write a program for reading one dimensional array X(I), then arrange its element ascending (4chai) then print matrix after change.arrow_forwardplease write a matlab codearrow_forward
- As4. This is my third time asking this question. Please DO NOT copy and paste someone else's work or some random notes. I need an answer to this question. There is a mass attached to a spring which is fixed against a wall. The spring is compressed and then released. Friction and is neglected. The velocity and displacement of the mass need to be modeled with an equation or set of equations so that various masses and spring constants can be input into Matlab and their motion can be observed. Motion after being released is only important, the spring being compressed is not important. This could be solved with dynamics, Matlab, there are multiple approaches.arrow_forwardPlease write a matlab code to solve thisarrow_forward2 3 4 5 6 1. (Make a MatLab code) Using for loop, write a script that will generate the all following multiplication table at once: 4 6 8 10 12 5 7 9 11 10 14 18 22 10 13 16 20 26 32 17 21 34 42 26 52arrow_forward
- Elements Of ElectromagneticsMechanical EngineeringISBN:9780190698614Author:Sadiku, Matthew N. O.Publisher:Oxford University PressMechanics of Materials (10th Edition)Mechanical EngineeringISBN:9780134319650Author:Russell C. HibbelerPublisher:PEARSONThermodynamics: An Engineering ApproachMechanical EngineeringISBN:9781259822674Author:Yunus A. Cengel Dr., Michael A. BolesPublisher:McGraw-Hill Education
- Control Systems EngineeringMechanical EngineeringISBN:9781118170519Author:Norman S. NisePublisher:WILEYMechanics of Materials (MindTap Course List)Mechanical EngineeringISBN:9781337093347Author:Barry J. Goodno, James M. GerePublisher:Cengage LearningEngineering Mechanics: StaticsMechanical EngineeringISBN:9781118807330Author:James L. Meriam, L. G. Kraige, J. N. BoltonPublisher:WILEY