Phasor diagrams in GNU Octave

I’ve been experimenting with plotting phasor diagrams in GNU Octave. This approach may also work in MATLAB, but I haven’t tried that yet. I need to tidy this up a little more to make it convenient to reuse, but I’m capturing it as it is for the time being, so that I don’t lose it.

GNU octave phasor diagram

This is my M-file, “example.m”:

% GNU Octave phasor plot example
% Written by Ted Burke - 19-2-2014

% Create a few complex values
z1 = 3 + 3j;
z2 = 2 + 4j;
z3 = z1 * z2;

% Calculate a suitable axis limit based on phasors
m = 1.2 * max([real([z1 z2 z3]) imag([z1 z2 z3])]);

% Create a new figure window
hold on

% Plot phasors one at a time

% Add horizontal and vertical axes
plot([-m m],[0 0])
plot([0 0],[-m m])

% Set axis limits and aspect ratio
axis([-m,m,-m,m], 'square')

To install octave in Linux (debian), just run the following command as root:

apt-get install octave

Then, to run the example:


This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s