1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 19:21:44 +02:00
ben-wpan/usrp/d.c
Werner Almesberger e445fe1b01 usrp/: a set of utilities for testing board performance with an USRP2
- 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"
2010-09-16 01:01:02 -03:00

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;
}