Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3550
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Date | 2017-01-28 17:47 -0800 |
| References | <ea07f149-8203-4653-a767-3313ddbbc8af@googlegroups.com> <n2phrs$je3$1@solani.org> <82271787-2bb8-4291-8705-e6eb4656b610@googlegroups.com> |
| Message-ID | <23acc91e-8c60-44e4-a31d-fea3ce2a9c87@googlegroups.com> (permalink) |
| Subject | Re: Need some help -- plot fast fourier transform |
| From | drmcnelson@gmail.com |
Here is a more complete answer: The output of an FFT is a list of complex values. If you use the realft algorothm from Numrec or something similar, for N discrete sampled real values, you get N/2 complex values, or N/2 pairs of real and imaginary values. As I recall, NumRec packs them into doubles. The array elements at even indices are the real part and the array elements at odd indices are the imaginary part. You need to output them from your c program as two columns, d[2*i], d[2*i+1], or output the square magnitude of each pair (d[2*i]*d[2*i]+d[2*i+1]*d[2*i+1]) If you output them as two columns, you plot them as sqrmag(a,b) = a**2 +b**2 plot 'myfile' using 0:(sqrmag($1,$2)) or if you output them as the square magnitude, you plot them as plot 'myfile' using 0:1 Note that these command graph the spectrum versus bin number. If you want to plot them versus frequency, replace the "0" by (($0/Ndata)*samplingrate) where the number of frequency bins Nbins = Ndata/2, or you can do that in your program and output an extra column for the frequency and adjust the plot commands accordingly.
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar
Need some help -- plot fast fourier transform dakupoto@gmail.com - 2015-11-20 20:56 -0800
Re: Need some help -- plot fast fourier transform Karl-Friedrich Ratzsch <mail.kfr@gmx.net> - 2015-11-21 11:43 +0100
Re: Need some help -- plot fast fourier transform dakupoto@gmail.com - 2015-11-21 19:13 -0800
Re: Need some help -- plot fast fourier transform Richard Owlett <rowlett@cloud85.net> - 2015-11-22 04:58 -0600
Re: Need some help -- plot fast fourier transform Thomas Wagner <thomas.wagner.marl@freenet.de> - 2015-11-25 00:51 +0100
Re: Need some help -- plot fast fourier transform Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2015-11-25 01:25 +0100
Re: Need some help -- plot fast fourier transform drmcnelson@gmail.com - 2017-01-28 17:47 -0800
Re: Need some help -- plot fast fourier transform John Edwards <johned0@gmail.com> - 2017-01-31 04:18 -0800
Re: Need some help -- plot fast fourier transform Richard Owlett <rowlett@cloud85.net> - 2015-11-21 10:07 -0600
Re: Need some help -- plot fast fourier transform drmcnelson@gmail.com - 2017-01-28 17:08 -0800
csiph-web