# Multiply block problem in GRC 3.6.5.1

**URL:** <https://www.ruby-forum.com/t/multiply-block-problem-in-grc-3-6-5-1/240107>\
**Category:** GNU Radio\
**Created:** [March 27, 2014, 11:32pm UTC](https://www.ruby-forum.com/t/multiply-block-problem-in-grc-3-6-5-1/240107 "2014-03-27T23:32:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [March 27, 2014, 11:32pm UTC](https://www.ruby-forum.com/t/multiply-block-problem-in-grc-3-6-5-1/240107/1 "2014-03-27T23:32:15Z")

</div>

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.  
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  
Sorry for my bad english.  
Best regards

Att.:  
Winderson Luiz Franzoi Speranzini

---

<div class="post-metadata">

**Author:** ![Winderson\_Luiz\_Fran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7cd45c/32.png) [@Winderson\_Luiz\_Fran](https://www.ruby-forum.com/u/Winderson_Luiz_Fran)\
**Post date:** [March 28, 2014, 12:18am UTC](https://www.ruby-forum.com/t/multiply-block-problem-in-grc-3-6-5-1/240107/2 "2014-03-28T00:18:59Z")

</div>

On Mar 27, 2014, at 15:10, Winderson Luiz Franzoi Speranzini  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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 R. [http://switchb.org/kpreid/](http://switchb.org/kpreid/)

---

<div class="post-metadata">

**Author:** ![Winderson\_Luiz\_Fran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7cd45c/32.png) [@Winderson\_Luiz\_Fran](https://www.ruby-forum.com/u/Winderson_Luiz_Fran)\
**Post date:** [March 28, 2014, 1:00am UTC](https://www.ruby-forum.com/t/multiply-block-problem-in-grc-3-6-5-1/240107/3 "2014-03-28T01:00:27Z")

</div>

Oh, thank you friend for this quick reply. I will do what you said  
By the way, where can I find the blocks source codes?  
Thank you again!

Att.:  
Winderson Luiz Franzoi Speranzini
