示例#1
0
static void
print_summary(struct measurements *m)
{
	int res;
	int max_freq = (int)m->max_frequency,
	    mean_freq = (int)mean_frequency(m);

	printf("Estimated sampling frequency: %dHz (mean %dHz)\n",
	       max_freq, mean_freq);

	if (max_freq > mean_freq * 1.3)
		printf("WARNING: Max frequency is more than 30%% higher "
		       "than mean frequency. Manual verification required!\n");

	printf("To calculate resolution, measure physical distance covered\n"
	       "and look up the matching resolution in the table below\n");

	m->distance = abs(m->distance);

	/* If the mouse has more than 2500dpi, the manufacturer usually
	   shows off on their website anyway */
	for (res = 400; res <= 2500; res += 200) {
		double inch = m->distance/(double)res;
		printf("%8dmm	%8.2fin	%8ddpi\n",
		       (int)(inch * 25.4), inch, res);
	}
	printf("If your resolution is not in the list, calculate it with:\n"
	       "\tresolution=%d/inches, or\n"
	       "\tresolution=%d * 25.4/mm\n", m->distance, m->distance);
}
示例#2
0
value_t mean_frequency(const vec& signal,const int fs)
{
	return mean_frequency(fft(signal,fs));
}