/*______________________________________________________________________ BHWTBL.C Blackman-Harris Window Table Generator Author: 24-APR-91, Ronnin Yee, Analog Devices DSP Div. (617) 461-3672 ______________________________________________________________________*/ #include #include #define MAX_LEN 16384 main() { int i, n, iter; double freq, c, a0=0.42659, a1=0.49656, a2=0.076848; double pi=3.14159265359; FILE *c_file; char filename1[25]; printf("%c%c%c%c",27,91,50,74); /*clear screen*/ printf("%c%c%c",27,91,72); /*curser home*/ printf("________________Blackman-Harris Window Table Generator____________\n"); printf("Generates Blackman-Harris Window coefficients for the 21k-ezlab demo\n"); printf("program.\n"); printf("24-APR-91, Ronnin Yee, Analog Devices\n"); printf("_____________________________________________________________\n"); printf("Enter the number of points (max %d) -> ",MAX_LEN); scanf(" %d",&n); iter=n/2; printf("\n Enter Blackman-Harris coeff table filename: "); scanf(" %s",filename1); c_file=fopen(filename1,"w"); freq=2.0*pi/(double)n; for (i=0; i <= iter; i++) { c=a0+a1*cos((double)i * freq)+a2*cos(2.0*(double)i * freq); fprintf(c_file,"%22.14e\n",c); printf("%d : %22.14e\r",i,c); } fclose(c_file); printf("\n\nFinished\n\n"); }