I want to realize the block "complex to Arg" which is a block in gnuradio in matlab.
I use the command angle
in matlab. But some results aren't same as in gnuradio.
For example,
In matlab,
angle(1.646236600879293e+03 + 8.043715071772031e+00i) = 0.004886084452240
while in gnuradio,
the block returns 0.00294448575004935
.
Can someone explain it? Or give me a hint on the command of matlab.
According to this discussion gnuradio does not use the libmath atan2 function for performance reasons. I believe matlab uses the libmath function instead. They also say that the error is larger in 0 or Pi/2, which is your case. Thus gnuradio arg and matlab angle are both correct, they just link to different implementations (of atan), with different performance and precision.