Hi all, I've been trying to create a block that helps me comparing two signals, and in order to achieve that I want to take a snapshot of one of them to characterize it in terms of mean and maximum value. The inputs are always positive and greater than zero. That part of the code goes as follows:
function::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]; float *first_profile = (float *) output_items[0]; float *second_profile = (float *) output_items[1]; if(!initial_vector_flag){ // run this loop only one time for (int i = 0; i < nsamples ; ++i) { // why 4096? for values greater than 4096 in[i] is 0, but why? std::memcpy(first_profile, in, noutput_items*sizeof(float)); sum_signal += in[i]; if (in[i] == 0) count++; signal_vector.push_back(in[i]); } initial_vector_flag = true; } double mean_value = sum_signal / vector_vector.size(); float max = max(signal_vector); So in this part I bypass the input to the output, but also want to save the values in a vector from which I calculate the biggest value of the sample and the mean of the saved realizations. However, I noticed that I can not deliberately choose the value of nsamples, and that it is only taking 4096 values from the input. Whenever nsamples>4096, the block fills the vector with 4096 correct values and the rest with zeros (sinking the value of the mean). I noticed that the number 4096 was correct just by afterwards counting the values on signal_vector that were different than zero (which were in every case 4096). From here two questions rise into my mind. 1. Where does the 4096 comes from? it is 2¹², which I don't recall being 12 the size of one datatype that is involved in my function. It is directly a value from scheduler and always the same? 2. If it is not always the same value, how I am indirectly fixing that amount of samples? I would like, if possible, to save more samples as it would reduce the variance of the calculations. Thank you in advance. Best Regards, -- Nicolás Cuervo Benavides Handy: +49 157 70476855 Electric and Electronic Engineering department. Electronic Engineering Universidad Nacional de Colombia -- Student M.Sc. Information and Communication Technology Karlsruher Institut für Technologie Karlsruhe, Baden Würtemberg, Germany
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio