Posted By

aturlapaty on 08/13/14


Tagged

signals systems


Versions (?)

Basic transformations on complex number


 / Published in: Python
 

URL: transformations of a complex number

Effect of rotating the phase of the complex number

  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Tue Aug 12 19:59:00 2014
  4.  
  5. @author: Anish
  6. """
  7.  
  8. # Importing libraries
  9. import os
  10. os.system('cls')
  11. import numpy as np
  12. import matplotlib.pyplot as plt
  13. #j = sqrt(-1)
  14. r0 = 2.0
  15. theta = pi/4.0
  16. x0 = r0*cos(theta)
  17. y0 = r0*sin(theta)
  18. zvec = [x0+1j*y0,x0-1j*y0, sqrt(x0**2 +y0**2), -x0-1j*y0,-x0+1j*y0]
  19.  
  20. for ix in range(0, 5):
  21. x = real(zvec[ix])
  22. y = imag(zvec[ix])
  23. plot(x,y,'o')
  24. text(x, y,'z%1.0f'%(ix),fontsize = 12)
  25.  
  26. plt.xlabel('real')
  27. plt.ylabel('imaginary')

Report this snippet  

You need to login to post a comment.