% EXERCISE:     POWERS OF COMPLEX NUMBERS
%
% Program:      cn_powers.m
% Written by:   
% For:          EE 311
%               Exercise For Computer Lab 1
% Date:         5-31-2001
% Purpose:      This program plots three complex numbers
%               each raised to the powers 1,2,...,32
clear all, hold off, clf reset

j=sqrt(-1);
% Three complex numbers: z1, z2, and z3
z1=0.95*exp(j*2*pi/16);
z2=1*exp(j*2*pi/16);
z3=1.05*exp(j*2*pi/16);

title('Powers of Complex Numbers, by S.T. Udent')
xlabel('Real Axis'), ylabel('Imag Axis')
hold on

for n=1:32
   z1_vec(n)=z1^n;		% create vector of z1^n for n = 1,2,3,...,32
   z2_vec(n)=z2^n;		% create vector of z2^n for n = 1,2,3,...,32
   z3_vec(n)=z3^n;		% create vector of z3^n for n = 1,2,3,...,32
end

% Plot results
plot(real(z1_vec),imag(z1_vec),'r')
plot(real(z2_vec),imag(z2_vec),'k')
plot(real(z3_vec),imag(z3_vec),'b')

%************************************************************************
% Exercises:                                                            *
% 1.) Explain the path that each curves takes. Do any of the            *
%     curves appear to be converging or diverging? Explain what         *
%     happens when you take:                                            *
%           lim (z1^n), lim (z2^n), and lim (z3^n)                      *
%           n->oo       n->oo           n->oo                           *
%                                                                       *
%     (n->oo means as n approaches infinity)                            *
%                                                                       *
% 2.) Geometric Series: A geometric series is a sum a number raised to  *
%     to various powers. This program will graph a geometric sequence   *
%     of numbers. If you take an infinite sum of this geometric         *
%     sequence you get a geometric series. Evaluate a geometric series  *
%     for each of the complex numbers: z1, z2, and z3.                  *
%                                                                       *
%                   infinity                                            *
%       Example:      sum (z^n), where z=z1,z2,z3                       *
%                     n=0                                               *
%                                                                       *
%     Comment on these geometric series. Do any of them have a finite   *
%     answer?                                                           *
%                                                                       *
% 3.) Modify the current program, so that the output looks like that    *
%     of 'output_fancy.htm'(located on the same webpage that you found  *
%     this file. See the demo on printing if you get stuck. Turn in     *
%     your file. See the demo on printing if you get stuck. Turn in     *
%     your program and the output with your name in the title.          *
%     TIP: Do not print out the complex number z2 on this output        *
%                                                                       *
%************************************************************************ 