discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] how to use if statement in GNU radio


From: Pu, Di
Subject: [Discuss-gnuradio] how to use if statement in GNU radio
Date: Fri, 12 Sep 2008 10:19:43 -0400

Hi All,

I was trying to combine two signals in GNU radio. One is a sinusoid wave, and 
the other is a constant wave. The amplitude of the sine wave is higher than 
that of the constant wave. What I want to do is to truncate the top part of the 
sinusoid wave: when the sine wave is higher than the constant wave, let it be 
the constant wave. I don't know whether it is feasible with IF statement in GNU 
radio.

The IF part of my code:
        self.siggen = gr.sig_source_f (self.usb_freq (),
                                       gr.GR_SIN_WAVE,
                                       self.waveform_freq,
                                       self.waveform_ampl,
                                       self.waveform_offset)

        self.siggen1 = gr.sig_source_f (self.usb_freq (),
                                       gr.GR_CONST_WAVE,
                                       self.waveform_freq,
                                       0.5*self.waveform_ampl,
                                       self.waveform_offset)

        if self.siggen < self.siggen1:
             self.connect (self.siggen, self.src)
        else:
             self.connect (self.siggen1, self.src)

If it is not doable, could you provide me with some methods to do this? Thank 
you very much!

Sincerely,
Di




reply via email to

[Prev in Thread] Current Thread [Next in Thread]