|| On Thu, 3 Mar 2005 10:34:15 -0500 (EST)
 || Charles Clancy <[EMAIL PROTECTED]> wrote: 

 clancy> Cool, that seems to work.  Is there a derivative block?  Something
 clancy> that takes float f(x) and returns float f'(x)?

A filter with taps [1, 0, -1] works "satisfactorily" as a differentiator. Try
this small program.


- ramakrishnan

#!/usr/bin/python
# diff.py 

from gnuradio import gr
from gnuradio import audio
from gnuradio.wxgui import stdgui, fftsink, scopesink
import sys
import os
import wx

class app_flow_graph (stdgui.gui_flow_graph):
    def __init__(self, frame, panel, vbox, argv):
        stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)

        sampling_freq = 32e3

        freq = parse_arguments (argv[1:])
        
        # create signals
        src1 = gr.sig_source_f (sampling_freq,gr.GR_COS_WAVE,1000,1,0) 

        coeff = [1,0,-1]
        filter = gr.fir_filter_fff (1, coeff)
        
        # create a probe
        #block, fft_win = fftsink.make_fft_sink_f (self, panel, "Spectrum", 
512, audio_rate)
        scopeblock, scope_win = scopesink.make_scope_sink_f (self, panel, 
"Spectrum", sampling_freq)

        self.connect (src1, filter)
        self.connect (filter, scopeblock)

        vbox.Add (scope_win, 1, wx.EXPAND)
        
            
def parse_arguments (args):
    freq = float (args[0])
    print "Tuning to freq  %d" % (freq)
    return freq


if __name__ == '__main__':
    app = stdgui.stdapp (app_flow_graph, "Spectrum")
    app.MainLoop ()
    
                    


-- 
    Ramakrishnan                   http://www.hackGNU.org/
    Use Free Software -- Help stamp out Software Hoarding!


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to