[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] phase accumulator in gr_frequency_modulator_fc
From: |
Brian Padalino |
Subject: |
Re: [Discuss-gnuradio] phase accumulator in gr_frequency_modulator_fc |
Date: |
Mon, 9 Nov 2009 15:56:43 -0500 |
2009/11/9 fangming he <address@hidden>:
> Hi, All,
>
> I cannot understand why the phase accumulator should be limited to
> [-16*pi,16*pi]. Please clarify it for me if you have some ideas on it.
>
> The following is the code in this class:
> if (fabs (d_phase) > 16 * M_PI){
> double ii = trunc (d_phase / (2 * M_PI));
> d_phase = d_phase - (ii * 2 * M_PI);
> }
My guess is that there is still only so much precision in a floating
point number. Knowing you are going to reduce the phase down modulo
2*pi, when dealing with large numbers, the error really starts to
accumulate.
Try it out. Take a phase value and add 2*pi, then reduce that large
number down by 2*pi. How many iterations does it take before you have
a significant error?
This is only a guess and by no means anything else. If someone more
knowledgeable would like to shed some light, please do so.
Brian