Hi All:

I'm trying to use the matplotlib psd function to plot some data.  The
result from MATLAB's pWelch function looks vastly different.

Any suggestions/recommendations would be greatly appreciated!

THANXS

amb

 

Here is the MATLAB code:

Fs = 13e6;

fid = fopen('C:\asp\roseRT\ics_output.bin', 'r', 'ieee-le');

s = fread(fid, [2, Inf], 'int32');

fclose(fid);

z = complex(s(2,:), s(1,:));

pwelch(z, [], [], [], Fs)

 

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.le...@saic.com 

 

------------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to