Subversion Repositories svnkaklik

Compare Revisions

Ignore whitespace Rev 510 → Rev 511

/programy/C/avr/akcelerometr/a2dtest.c
29,7 → 29,7
double err=0;
 
for(i=0; i<size; i++) err += square(buf[i]-average); // sum quadratic errors
err = sqrt((1/size)*err);
err = sqrt((1/(double)size)*err);
return err;
}
 
86,8 → 86,8
for(i=0; i<BUFLEN; i++) fi += fibuf[i]; // sum recorded angles
fi = (fi/BUFLEN)+PI; // average recorded angles and expand product to whole circle
err=quadraticerror(fi,fibuf,BUFLEN);
radtodeg(fi,&fi_deg,&fi_min,&fi_sec);
err=quadraticerror((fi-PI),fibuf,BUFLEN);
radtodeg(fi,&fi_deg,&fi_min,&fi_sec); //translate radians to degrees
radtodeg(err,&err_deg,&err_min,&err_sec);
rprintf("fi:%d.%d.%d +- %d.%d.%d \r\n", fi_deg, fi_min, fi_sec, err_deg, err_min, err_sec);