mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-29 18:16:16 +02:00
e445fe1b01
- usrp/d.c: reduce the number of data points in a file produced by usrp2_rx_cfile.py and print them as text suitable for gnuplot - usrp/p.c: determine the peak amplitude in a series of transmissions, filtering noise and artefacts at the beginning of the data file - usrp/step: step through all channels and measure TX power (for antenna tuning) - usrp/Makefile: built "p" and "d"
34 lines
406 B
C
34 lines
406 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
|
|
#define N 100
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
float c[2];
|
|
int n = 0;
|
|
float sum = 0;
|
|
size_t s;
|
|
|
|
|
|
while (1) {
|
|
s = fread(c, sizeof(c), 1, stdin);
|
|
if (!s) {
|
|
if (!ferror(stdin))
|
|
break;
|
|
if (s < 0) {
|
|
perror("read");
|
|
return 1;
|
|
}
|
|
}
|
|
sum += hypot(c[0], c[1]);
|
|
if (n++ % N)
|
|
continue;
|
|
printf("%f\n", sum/N);
|
|
sum = 0;
|
|
}
|
|
return 0;
|
|
}
|