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

📄 pulse.c

📁 快速傅利叶变换 C 语言源代码
💻 C
字号:
/* *	pulse.c * *	Version 2.6 by Steve Sampson, Public Domain, November 1988 * *	This program is used to generate time domain pulse data	for fft.c. */#include <stdio.h>#include <alloc.h>#define SAMPLES	256double	Sample, Pw, Time, Real[SAMPLES], Imag[SAMPLES];FILE	*Fp;main(argc, argv)int	argc;char	**argv;{	register int	loop;	if (argc != 2)  {		fprintf(stderr,"Usage: pulse output_file\n");		exit(1);	}	printf("Input The Pulse Width (Seconds) ? ");	scanf("%lf", &Pw);	printf("Input The Sampling Time (Seconds) ? ");	scanf("%lf", &Sample);	Time = 0.0;	for (loop = 0; loop < SAMPLES; loop++)  {		if (Time < Pw)			Real[loop] = 1.0;		else			Real[loop] = 0.0;		Imag[loop] = 0.0;		Time += Sample;	}	if ((Fp = fopen(*++argv, "wb")) == NULL)  {		fprintf(stderr,"pulse: Unable to create write file\n");		exit(1);	}	fwrite(Real, sizeof(double), SAMPLES, Fp);	fwrite(Imag, sizeof(double), SAMPLES, Fp);	fclose(Fp);	putchar('\n');	exit(0);}

⌨️ 快捷键说明

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