# Complex sin & cos in grc

I am confused about the output of sin and cos sinks with complex output
in
grc. I set up a test case where I generate a sin and a cosine and plot
them
on the same scope. Their I & Q values overlap exactly, should they not
be
shifted by 90 degrees? Or am I looking at this wrong?

Picture follows:
(you can’t see the red or purple plots, but red is the same as blue, and
purple is the same as green). The flow graph is shown at left.

Thanks,
Mike

On 03/17/2011 08:39 PM, Mike B wrote:

I am confused about the output of sin and cos sinks with complex output in
grc. I set up a test case where I generate a sin and a cosine and plot them
on the same scope. Their I & Q values overlap exactly, should they not be
shifted by 90 degrees? Or am I looking at this wrong?

Picture follows:
(you can’t see the red or purple plots, but red is the same as blue, and
purple is the same as green). The flow graph is shown at left.

It looks like nobody implemented a d_nco.cossin

This is the complex code in gr_sig_source:

case GR_SIN_WAVE:
case GR_COS_WAVE:
d_nco.sincos (optr, noutput_items, d_ampl);
if (d_offset == gr_complex(0,0))
break;

``````for (int i = 0; i < noutput_items; i++){
optr[i] += d_offset;
}
break;
``````

This is the real code:

case GR_SIN_WAVE:
d_nco.sin (optr, noutput_items, d_ampl);
if (d_offset == 0)
break;

``````for (int i = 0; i < noutput_items; i++){
optr[i] += d_offset;
}
break;
``````

case GR_COS_WAVE:
d_nco.cos (optr, noutput_items, d_ampl);
if (d_offset == 0)
break;

``````for (int i = 0; i < noutput_items; i++){
optr[i] += d_offset;
}
break;``````