Kompluvut1.m Huvittelua ja hyödyttelyä kompleksiluivuilla, osa 1

10.8.2010 HA

clear
close all
z=2+3*i
phi=angle(z)
r=abs(z)
r*sign(z)
r*(cos(phi)+i*sin(phi))
u=sign(z)
w=u.^(0:10)
plot(w),axis square, hold on, plot(w,'*')
compass(w,'k')
compass(u,'r')
grid on
gtext('1')
gtext('u')
gtext('u^2')
gtext('u^3')
gtext('u^4')
gtext('u^5')
gtext('u^{10}')
title('Luvun sign(2+3i) potenssit 0..10')
z =
   2.0000 + 3.0000i
phi =
    0.9828
r =
    3.6056
ans =
   2.0000 + 3.0000i
ans =
   2.0000 + 3.0000i
u =
   0.5547 + 0.8321i
w =
  Columns 1 through 4
   1.0000             0.5547 + 0.8321i  -0.3846 + 0.9231i  -0.9814 + 0.1920i
  Columns 5 through 8
  -0.7041 - 0.7101i   0.2002 - 0.9798i   0.9263 - 0.3769i   0.8274 + 0.5616i
  Columns 9 through 11
  -0.0084 + 1.0000i  -0.8367 + 0.5477i  -0.9198 - 0.3923i