⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 noise.c

📁 内核中关于nano计时的功能
💻 C
字号:
/* * Program to generate data file for simulated random-walk frequency * noise. It does this by generating random Gaussian samples and
 * integrating once for frequency and twice for phase. The file is read
 * later by Matlab to generate Allan deviation plots and time series
 * plots. * * Output format: <second> <phase> <frequency> * ... * 10 -0.319 -0.064 * 11 -0.370 -0.051 * 12 -0.412 -0.04 * ... */#include <stdlib.h>extern double gauss(double);double phase, freq;double sigma = 4.5e-10;			/* default matches ntpsim */long sim_end = 20;			/* default for test */intmain(	int argc,	char **argcv	){	int i, temp;	while ((temp = getopt(argc, argcv, "f:s:")) != -1) {		switch (temp) {			/*			 * -f set frequency parameter			 */			case 'f':			sscanf(optarg, "%lf", &sigma);			continue;			/*			 * -s set run length (s)			 */			case 's':			sscanf(optarg, "%ld", &sim_end);			continue;			/*			 * unknown command line switch			 */			default:			printf("unknown switch %s\n", optarg);			continue;		}	} 	for (i = 0; i < sim_end; i++) {		freq += gauss(sigma);		phase += freq;		printf("%d %.3f %.3f\n", i, phase * 1e6, freq * 1e6);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -