http://www.nabble.com/file/p24713274/psd_testpng.png http://www.nabble.com/file/p24713274/psd_testpng.png psd_testpng.png #This program below do reveal that mlab.psd and pyplot.psd are different
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
dt = np.pi / 100.
fs = 1. / dt
t = np.arange(0, 8, dt)
y = 10. * np.sin(2 * np.pi * 4 * t) + 5. * np.sin(2 * np.pi * 4.25 * t)
y = y + np.random.randn(*t.shape)
print "t=",t
print "y=",y
print "fs=",fs #Plot the raw time series
fig = plt.figure()
fig.subplots_adjust(hspace=0.6, wspace=0.5)
And here is the (hypothetically) equivalent Python/matplotlib code:
datatype = np.complex64
fd = open(self.filename, 'rb')
read_data = np.fromfile(file=fd, dtype=datatype)
Pxx,freqs = psd(read_data,Fs=13000000)
self.axes.plot(freqs, 10*log10(Pxx) )
self.canvas.draw()
Ambrose Lewis
SAIC
4001 N Fairfax Drive, Suite 400
Arlington, VA 22203
703.558.2786
ambrose.j.lewis@...2441...
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options
--
View this message in context: http://www.nabble.com/psd-question…-tp21458898p24713274.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
The plotting command pyplot.psd scales the numbers in decibels (the dB
in the ylabel in pyplot.psd). mlab.psd just returns the unscaled
power. So in your example in subplot(3,1,3), call before plotting
x = 10*np.log10(np.absolute(x))
JDH
···
On Wed, Jul 29, 2009 at 1:39 AM, 3togo<freetogo@...287...> wrote: