discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Complex sin & cos in grc


From: Josh Blum
Subject: Re: [Discuss-gnuradio] Complex sin & cos in grc
Date: Thu, 17 Mar 2011 22:23:36 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8


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:
> https://picasaweb.google.com/113070091732402272078/GRC1#5585258130670915570
> (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;



reply via email to

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