AnsweredAssumed Answered

arm_rms_q15

Question asked by emilien on Jul 12, 2012
Latest reply on Jul 16, 2012 by emilien

Hi,

 

   I'm in fixed-point trouble... I'm using the DSP on a twr-k60n512, here is what i wrote:

 

// define some values:

#define VECTOR_SIZE 40

float32_t inputU[VECTOR_SIZE] = {0.909663738089 ,  0.169819655916 ,  0.268918462228 ,  0.405608980659 ,  0.694552034332 ,  0.213238658369 ,  0.746090714595 ,  0.146591804815 ,  0.581591611035 ,  0.00824751271313 ,  0.815848907608 ,  0.28001570888 ,  0.459783555723 ,  0.251290291806 ,  0.677502043376 ,  0.80253906042 ,  0.817930529136 ,  0.968525553535 ,  0.428420247333 ,  0.256734208324 ,  0.62360547369 ,  0.294399769527 ,  0.56524282032 ,  0.228892907349 ,  0.00193085195605 ,  0.906498765728 ,  0.754109326089 ,  0.347481953721 ,  0.616133190588 ,  0.7399958052 ,  0.898959525768 ,  0.849186403099 ,  0.219555894784 ,  0.635015634272 ,  0.0762971785054 ,  0.0306477419895 ,  0.490306877931 ,  0.954647274336 ,  0.765811989471};
q15_t qinputU[VECTOR_SIZE];
arm_float_to_q15(inputU, qinputU, VECTOR_SIZE);

Then, I used the arm_mult_q15 and arm_mean_q15 functions and the results were correct, but when I try:

 

q15_t urms;

arm_rms_q15(inputU, VECTOR_SIZE, &urms);

float32_t display;

arm_q15_to_float(&urms, &display, 1);
printf("urms = %f\n", display);

 

It outputs rms = 0.277112, but it should be around 0.588939 (from my python script which I'm quite sure is correct).

What do you think ? Is there a problem with this arm_rms_q15 function or I'm doing something wrong ?

 

Thanks,

 

--

Emilien

 

Outcomes