Hi would you mind answering the question? I appreciate your help. (matlab) - usi
ID: 3237195 • Letter: H
Question
Hi would you mind answering the question?
I appreciate your help.
(matlab) - using matlab program
Create a matrix, then access parts of it. Do matrix multiplication. Make a new script and copy your anonymous function over, along with the code to make tSample and ySample. Combine your tSample and ySample values from problem 1 into a 2 x n matrix, the first row being tSample, the second row being ySample. Call the matrix. mXY. Now write a plot function that plots t versus y, using mxY. How do you get the first row of mXY? The second row? Answer: plot(mXY(1, :), mXY(2, :)); Now plot markers at every 10th sample point, on top of the function plot. Again, use mXY. How do you get every 10th sample point from mXY? Now create a 2 times 2 rotation matrix that rotates by 45 degrees. Multiply mXY by this matrix to create a new matrix, mXYrot. Plot mXYrot on top of your initial graph.Explanation / Answer
The MATLAB code is given by:
x = linspace(0,10);
y = sin(x);
mXY=[x;y];
markerIndices=(1:10:length(y));
plot(mXY(1,:),mXY(2,:))
hold on
plot(x(markerIndices), y(markerIndices), 'b*')
R=rotx(45);
R=R(1:2,1:2);
mXYrot=R*mXY;
plot(mXYrot(1,:),mXYrot(2,:))
hold off
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.