[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Multiply block problem in GRC 3.6.5.1
From: |
Kevin Reid |
Subject: |
Re: [Discuss-gnuradio] Multiply block problem in GRC 3.6.5.1 |
Date: |
Thu, 27 Mar 2014 16:17:46 -0700 |
On Mar 27, 2014, at 15:10, Winderson Luiz Franzoi Speranzini <address@hidden>
wrote:
> Hello GRC community,
> I'm initiating with grc, trying to make a simple BASK. I searched a lot in
> the mailing list and in the tracker (I don't know if it's called that way)
> but I was unable to find anything about. It's a simple problem (maybe due my
> GRC version) that does not ruin my projects at all.
> When I use the multiply block, inputing a cossine(12kHz) and a
> rectangular(1kHz) wave from the signal generator block, I don't get the nice
> BASK that we should (Viewed from a wx osciloscope). Instead, the cossine
> change the amplitude in the middle 3 cycles and last longer 3 other cycles
> than it should.
I wasn't sure myself what a complex square wave actually ought to be, so I took
a look at the source code and found this statement:
/* Implements a real square wave high from -PI to 0.
* The imaginary square wave leads by 90 deg.
*/
This would explain your observation, I think: the complex square wave provided
by GR is zero only 1/4 of the time. It probably isn't what you want.
> The fact is that it just happen when I use complex outputs and inputs. Both
> the I and Q wave have the same style. When I use real inputs, or if I
> separete the real and imag part, multiply they separately and then put
> together in a complex signal, it works like it should be. Maybe it can be an
> old and corrected bug
GR's multiply_cc block follows the rules of complex arithmetic as it should.
Complex multiplication is not component-wise multiplication.
To get the result I think you had in mind, then you should multiply the complex
sinusoid by a _real_ square wave. That is, set your square wave signal
generator to have a float output, convert the output to complex (leaving the
imaginary input unconnected, implicitly zero), then multiply it with the sine.
--
Kevin Reid <http://switchb.org/kpreid/>