Plot tanx function


/ Published in: Python
Save to your folder(s)

This code is connected to following youtube video on complex plane.
http://youtu.be/oPIEH6hivEw


Copy this code and paste it in your HTML
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Mon Aug 04 22:20:13 2014
  4.  
  5. @author: Anish
  6. """
  7.  
  8. # -*- coding: utf-8 -*-
  9. """
  10. Spyder Editor
  11.  
  12. """
  13. # Importing libraries
  14. import os
  15. os.system('cls')
  16. import numpy as np
  17. import matplotlib.pyplot as plt
  18. import math
  19. #------------------------------------------------------------------------------
  20. # Parameters
  21. N = 145.0;
  22. k = 1.0
  23. #l = 5.0;
  24. #------------------------------------------------------------------------------
  25. # Definition of the array and the sinusoids
  26. nvec = np.linspace(-N+1, N-1, num=N)
  27. y1 = tan(pi*k*nvec/N)
  28. #y2 = cos(2.0*pi*l*nvec/N)
  29. #------------------------------------------------------------------------------
  30. # Plotting
  31. plt.plot(180*nvec/N,y1,'or-')
  32.  
  33. plt.ylabel('Tanget',fontsize=14, color='blue')
  34. plt.xlabel('Angle (Degrees)',fontsize=14, color='blue')
  35. plt.show()
  36. #------------------------------------------------------------------------------

URL: PlotTanX

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.