MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Christian on 29 Mar 2013

Write a Matlab script that takes a (column) vector v, an angle (in radians), a natural number N and does the following: it plots the vector v in blue and performs N (counter-clockwise) rotations of v by the angle . The first rotation of v is plotted using a red dashed line and all the other rotated vectors are plotted in solid red lines.

Here is what I have so far...

function lab8taskI(v,theta,N)

m=v(1,:); n=v(2,:);

quiver(0,0,m,n,1,'b') grid on; hold on;

R=[cos(theta) -sin(theta);sin(theta) cos(theta)];

A=R*v; y=A(1,:); z=A(2,:);

quiver(0,0,y,z,1,'--r')

I plotted the first two vectors, now I need to find the next N rotations and graph them, I can't think of how to do that with a for loop?

*No products are associated with this question.*

## 0 Comments