Hi fellow MatLabbers, this is my first post. I hope I hang around here and ask questions and hopefully answer some at some point.
So… My first post question is:
I have a triangle with vectors (1,0) (2,4) and (-2,2) and I am supposed to rotate it by 2pi/3 in respect to the ORIGIN. Then I need to calculate the new coordinates after the rotation. Then I need to plot both the original and rotated triangle. This is what I have so far:
———–
clear allx = [1 2 -2 1];y = [0 4 2 0];theta = (2*pi)/3;v=[x;y];R = [cos(theta) sin(theta); -sin(theta) cos(theta)];so = R*v; x_rotated = so(1,:);y_rotated = so(2,:);% make a plot
plot(x, y, 'k-', x_rotated, y_rotated);axis equalx_rotatedy_rotated
———–
I am not entirely sure if my result is correct because I assume since it needs to rotate in respect to the origin, the first vector should? stay the same.
Best Answer