discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Frequency modulation in GRC


From: Activecat
Subject: Re: [Discuss-gnuradio] Frequency modulation in GRC
Date: Mon, 26 May 2014 10:20:22 +0800

On 25.05.2014 20:01, jason sam wrote:
> But if it is doing FM then there should be some min and max
> frequencies between which the signal will be switching?


If you refer to the source code of the frequency_modulator_fc_impl.cc, then the min and max frequencies could be calculated.

Says, your sampling rate is samp_rate

Assuming the lowest input value to the FM block is zero, then
  minimum frequency of the FM output = samp_rate * sensitivity / ( 2 * PI )

Assuming the highest input value to the FM block is Vmax, then
  maximum frequency of the FM output = samp_rate * ( sensitivity + Vmax ) / ( 2 * PI)


For reference, the work function of the FM block is as below.

    int
    frequency_modulator_fc_impl::work( int noutput_items,
                      gr_vector_const_void_star &input_items,
                      gr_vector_void_star &output_items)
    {
          const float *in = (const float*)input_items[0];
          gr_complex *out = (gr_complex*)output_items[0];

          for(int i = 0; i < noutput_items; i++)
          {
                d_phase = d_phase + d_sensitivity * in[i];

                while (d_phase > (float)(M_PI))
                  d_phase -= (float)(2.0 * M_PI);
               
                while (d_phase < (float)(-M_PI))
                  d_phase += (float)(2.0 * M_PI);

                float oi, oq;

                gr_int32 angle = gr::fxpt::float_to_fixed (d_phase);
                gr::fxpt::sincos(angle, &oq, &oi);
                out[i] = gr_complex(oi, oq);
          }

          return noutput_items;
    }

reply via email to

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