Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 3. Matrices offer a very convenient and powerful way to describe the rotation of 3-dimensional vectors in space. Specifically, the three matrices that describe
3
3. Matrices offer a very convenient and powerful way to describe the rotation of 3-dimensional vectors in space. Specifically, the three matrices that describe the rotation of a 3D vector R counter-clockwise by angles , , and about the X, Y , and Z axes, respectively, are given by cosB 0 sin B 0 10 sin 0 cos Ux= 0 cosa -sina y Uz= sin cos 0 0 sin cos Thus, to rotate a vector R counter-clockwise by an angle matrix-vector multiplication about the Y axis, we perform the to obtain the rotated vector R'. Similarly, if we want to rotate the vector R counter-clockwise by an angle y about the Z axis, and then counter-clockwise by an angle B about the Y axis, we perform the matrix-vector multiplication In component form. we can write out these matrix multiplications as k-1 Write a MatLab program rotation angle about the Z axis and a desired rotation angle about the Y axis. The program must use nested for loops to calculate and print out the components of the new rotated column vector R'. You may not use MatLab's built-in matrix multiplication operator (*) or the sum) function for this program. Instead you should use a nested for loop to multiply the matrix. that asks the user to enter a 3D column vector R as well as a desired MATLAB code please for both (a) To test your program, it's very useful to be able to visualize the result. If your input vector is named R and your rotated vector is named Rot, adding the following code to your program will produce a 3-D plot of the two vectors: parts A andB plot3(x, Y, Z, '-g*') axis (I-3 3 -3 3 -3 3]) grid on; hold on xlabel('X axis); ylabel('Y axis') zlabel ('Z axis') X = [O Rot (1)]; Y = [O Rot (2)]; Z = [O Rot (3)]; plot3 (X, Y, Z, ,-ro') legend'R', 'R\prime) hold off You can then visually check that your program is doing the right thing by rotating a vector about the Z axis only by a small amount (say 20), or rotating it about the Y axis only by a small amount. Note that you can look at the 3-D plot from any desired viewpoint by clicking on the "Rotate 3D" icon in toolbar of the plot window, and then dragging the mouse around within the window (b) Hand in a printout that shows the result obtained for the column vector R 1.31.4; 1.5 when it is rotated clockwise about the Z axis by -30 and then clockwise about the Y axis by -45Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started