Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Trying to plot vectors and then rotate one

Asked by Michael on 13 Mar 2013

I am trying to set up a phasor viewer, for my own use. I am not getting what I expected as far as the plots are concerned.

What I want is for example threephasev(10,45) should give two vectors, one from the origin to (10,0) and the other rotated by 45 degrees.

I might have issues with the ordering in the matrices.

Thank you, Mick

if true
  function [ output_args ] = threephasev( A,theta )
%threephasev A (magnitude) theta (phase angle)
%   Plots the phasor of a the phase source
%   Michael Carey
%   Student Deakin University
%   400100801
%   mpc.tab4(nospam)@gmail.com
%   12/3/2013

a = [ 0 0 ; A 0 ];

quiver(a(1),a(3),a(2),a(4));

% a(1) % a(3) % a(2) % a(4)

R=[ cosd(theta),-sind(theta) ; sind(theta),cosd(theta)];

b = R*a; hold on quiver(b(1),b(3),b(2),b(4));

end

0 Comments

Michael

Products

No products are associated with this question.

0 Answers

Contact us