Guest User

Untitled

a guest
Oct 7th, 2019
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Program for lab-4.3
  2.  
  3. import matplotlib.pyplot as plt
  4. from math import sin, cos, pi
  5. import random
  6. # Input list generation
  7. y=[]
  8. x=[]
  9. for i in range(250):
  10.     y.append(sin(i*pi/450)+cos(i*pi/500)+0.3*random.random())
  11. x=[i for i in range(len(y))]
  12.  
  13. #Function
  14. def myplot(plotarray):
  15.     '''
  16.    for gr in plotarray:
  17.        plt.plot(gr[0],gr[1])
  18.    '''
  19.     plt.plot(plotarray[0][0], plotarray[0][1], 'g-.')
  20.     plt.plot(plotarray[1][0], plotarray[1][1], 'bo')
  21.     plt.show()
  22. #=========================================================  
  23. # Part, students have to write
  24. #=========================================================
  25. plotarray=[(x,y),(x,y)]
  26.  # plotting
  27. myplot(plotarray)
RAW Paste Data