Question: To plot y = sin(x), we must define vectors of x and y values and then use the plot command. This can be done as
x = 0:0.1:6.3; y = sin(x);
plot(x, y)
(a) Let us define a rotation matrix and use it to rotate the graph of y = sin(x). Set
t=pi/4; c = cos(t): s = sin(t); R = [c,-s;s,c]
To find the rotated coordinates, set
Z = R*[x;y]; xl = Z(l,:); yl = Z(2,:);
The vectors xl and yl contain the coordinates for the rotated curve. Set
w = [0. 5]: axis(' square ')
and plot xl and yl using the MATLAB command
plot(xl, yl, w, w)
By what angles has the graph been rotated and in what direction?
(b) Use the rotation matrix R from part (a) to rotate the curve y = - sin(x). Plot the rotated curve. How does the graph compare to that of the curve from part (b)? Explain.
Step by Step Solution
3.44 Rating (163 Votes )
There are 3 Steps involved in it
a The graph has been rotated 45 in the counterclockwise direction b The grap... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
949-M-L-A-E (941).docx
120 KBs Word File
