sinegen.c

来自「"DIGITAL SIGNAL PROCESSING WITH C AND TH」· C语言 代码 · 共 23 行

C
23
字号
/*SINEGEN.C-GENERATES SINE VALUES FOR REAL FFT*/
#include <math.h>
#include <stdio.h>
#define N 512
#define pi 3.141592654

main()
{
  FILE *stream;
  int n;
  float result;
  stream = fopen("twid512.asm", "w+");
  fprintf(stream, "\n%s", "          .global    _sine");
  fprintf(stream, "\n%s", "          .data");
  fprintf(stream, "\n%s%7f", "_sine     .float     ", 0.0000000);
  for (n = 1; n < N/2; n++)
  {
    result = sin(n*2*pi/N);
    fprintf(stream, "\n%s%7f", "          .float     ", result);
  }
  fclose(stream);
}

⌨️ 快捷键说明

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