Le lundi 30 janvier 2012 à 11:45 +0000, David Craig a écrit :
> Hi I have some data for a 24hr period with a sample rate of 100
> samples/second. I want to create a power spectrum using matplotlibs
> function psd. I want it to have 10 minute windows with a 50% overlap,
> but cant seem to get the syntax right. My code is as follows:
> 
> NFFT = len(data)
> Fs = 100
> window=np.hanning(Fs*60*10)
> noverlap = window*0.5
> plt.psd(data, NFFT, Fs, window, noverlap )
> 
> anyone kow how to do this properly???

Be careful to use a suitable value for NFFT. It must be linked to your
windows size, not the total data length, and you would rather use a
power of 2 for efficience. Do not use it to increase the frequency
resolution (use pad_to instead).

Fs = 100
NFFT = Fs*60*10
Pxx, f = plt.psd(data, NFFT, Fs, window=np.hanning(NFFT), NFFT/2)

-- 
Fabrice Silva


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to