define vector by magnitude in matlab

115 Views Asked by At

I am working with MATLAB and I should draw some vectors which I have their lengths and angles. Does anyone know how it is possible?

1

There are 1 best solutions below

0
On BEST ANSWER

For example:

R = [1,2,3,4,5]; % radii
Theta = [pi/3, 2*pi/3, pi, 4*pi/3, 5*pi/3]; % angles
X = R .* cos(Theta);
Y = R .* sin(Theta);
compass(X,Y) 

enter image description here