Using the below python code, I am able to plot a graph. Can anyone please tell me how to modify this code to plot the graph continuously in real time?

from pylab import *
from rtlsdr import *    

sdr = RtlSdr()    

sdr.sample_rate = 2.4e6
sdr.center_freq = 93.5e6
sdr.gain = 50    
samples = sdr.read_samples(256*1024)

psd(samples.real, NFFT=1024, Fs=sdr.sample_rate/1e6, Fc=sdr.center_freq/1e6)
xlabel('Frequency (MHz)')
ylabel('Relative power (dB)')
  • $\begingroup$ Is there a reason not to use GnuRadio or similar tools? $\endgroup$ – MBaz Mar 25 '19 at 22:14
  • $\begingroup$ Thanks for your reply...you are right, we can use GNU Radio but I would like to do it with python. $\endgroup$ – user3661448 Mar 26 '19 at 3:21
  • $\begingroup$ Yeah, but a large part of GNURadio is written in Python. $\endgroup$ – MBaz Mar 26 '19 at 14:16
  • $\begingroup$ This is a python programming question not a signal processing question. I suggest you ask on the main stack overflow programming exchange. $\endgroup$ – PAK-9 Mar 27 '19 at 22:16
  • $\begingroup$ Thanks PAK-9, I will post this in Main StackOverFlow $\endgroup$ – user3661448 Mar 28 '19 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.