Hello! I'm new to GNU Radio and USRP. I've done this simple code below. class topBlock(gr.top_block): def __init__(self): gr.top_block.__init__(self) fftsize = 256 udecim = 256 mywin = window.blackmanharris(fftsize) fft = gr.fft_vcc(fftsize, True, mywin) signal = usrp.source_c(0,udecim) ss2v = gr.stream_to_vector(gr.sizeof_gr_complex, fftsize) v2ss = gr.vector_to_stream(gr.sizeof_gr_complex, fftsize) c2f = gr.complex_to_float(fftsize) v_sink = gr.vector_sink_c() f_sink = gr.file_sink(gr.sizeof_gr_complex, "fft.data") self.connect(signal, ss2v, fft, v2ss, f_sink) def main(): print "Initilizing.." tb = topBlock() print "Flowgraph start.." tb.run() print "Exiting.." if __name__ == "__main__": main() The thing is that I don't know what kind of values is the fft giving to the f_sink, because if a load them on octave using "y=read_complex_binary(...)", a run plot(abs(y(1:256)) it does come close to what I saw using the GUI version. Without looking at the scales there should be a spike in the middle of the graph. http://www.nabble.com/file/p22457062/scrsht.png Shouldn't the first 256 values be the first fft computed from the flowgraph? Thank you in advance! -- View this message in context: http://www.nabble.com/fft_vcc---file_sink-tp224570... Sent from the GnuRadio mailing list archive at Nabble.com.
on 2009-03-11 16:03
on 2009-03-11 17:59
On Wed, Mar 11, 2009 at 10:02 AM, E. Ornelas <firstname.lastname@example.org> wrote: > > > print "Flowgraph start.." > plot(abs(y(1:256)) > it does come close to what I saw using the GUI version. > Without looking at the scales there should be a spike in the middle of the > graph. > > http://www.nabble.com/file/p22457062/scrsht.png > > Shouldn't the first 256 values be the first fft computed from the flowgraph? The display (GUI) is probably shifting the output such that 0Hz is in the center, and you span from -Fs/2 to Fs/2 as opposed to a 0Hz to Fs span. Take a gander at fftshift() in octave. > Thank you in advance! You're welcome and good luck. Brian