Volk atan

Hi everybody,

I’m using “volk_32fc_s32f_atan2_32f_a” to compute phase of signal. It’s
important to know: what is the output phase interval of this function?
Is
it within [-pi/2,pi/2] as an standard atan function?

This shows its importance when we’re dealing with quadrature modulations
when you need to wrap the phase between [0,2pi] interval instead of
[-pi/2,pi/2].

As I see the output of this function, it also has the phase greater than
pi/2, so I guess it automatically wrap the phase. I didn’t see any hint
about this on the comments, so to be sure, I asked this.

Best,
Mostafa

Hi Mostafa,

On Thu, Feb 26, 2015 at 8:26 AM, Mostafa A.
[email protected]
wrote:

Hi everybody,

I’m using “volk_32fc_s32f_atan2_32f_a” to compute phase of signal.

If you are calling the _a version make sure that you know your buffer
is
aligned because you have allocated it yourself or have done an alignment
check. Otherwise it is best to just call the dispatcher,
volk_32fc_s32f_atan2_32f, and it will do the alignment check for you.

It’s important to know: what is the output phase interval of this
function? Is it within [-pi/2,pi/2] as an standard atan function?

It’s the same as the standard atan2f (from your C implementations
math.h)
which is a 2-argument atan. atan2’s usually return [-pi,pi] which is
also
the case with volk_32fc_s32f_atan2_32f. You can verify this yourself
with a
sample that follows.

This shows its importance when we’re dealing with quadrature modulations
when you need to wrap the phase between [0,2pi] interval instead of
[-pi/2,pi/2].

As I see the output of this function, it also has the phase greater than
pi/2, so I guess it automatically wrap the phase. I didn’t see any hint
about this on the comments, so to be sure, I asked this.

Good point. It’s worth documenting that the output is [-pi, pi]. I’ll
add
that in. Thanks for the suggestion!

Best,
Mostafa


Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

#include <stdio.h>
#include <volk/volk.h>

int main()
{
int N = 10;
unsigned int alignment = volk_get_alignment();
lv_32fc_t* in = (lv_32fc_t*)volk_malloc(sizeof(lv_32fc_t)N,
alignment);
float
out = (float*)volk_malloc(sizeof(float)*N, alignment);
float scale = 1.f; // we want unit circle

float delta = 2.f*M_PI/(float)N;
for(unsigned int ii = 0; ii < N; ++ii){
// Generate points around the unit circle
float real = std::cos((float)ii * delta);
float imag = std::sin((float)ii * delta);
in[ii] = lv_cmake(real, imag);
}

volk_32fc_s32f_atan2_32f(out, in, scale, N);

for(unsigned int ii = 0; ii < N; ++ii){
printf(“atan2(%1.2f, %1.2f) = %1.2f\n”,
lv_cimag(in[ii]), lv_creal(in[ii]), out[ii]);
}

volk_free(in);
volk_free(out);
return 0;
}

Nathan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs