Advertisement
DeaD_EyE

Realtime-Plot

May 9th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4.  
  5. i = np.sin(np.linspace(0, np.pi * 2, 1000))
  6. q = np.cos(np.linspace(0, np.pi * 2 * 4, 1000))
  7. plt.ion()
  8.  
  9. while True:
  10.     plt.pause(1/1000)
  11.     i = np.roll(i, 10)
  12.     q = np.roll(q, 5)
  13.     m = np.sqrt(i**2 + q**2)
  14.     plt.cla()
  15.     plt.plot(i)
  16.     plt.plot(q)
  17.     plt.plot(m)
  18.     plt.legend(['iData', 'qData', 'magnitude'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement