#include #include #include #define EXCLUSION 15 /* data length not to be considered as neighbors */ main(argc,argv) int argc; char *argv[]; { int i; int step; int length; /* length of the data */ int dim; /* embedding dimension */ int nnn; /* number of the nearest neighbors */ double p_nnn; /* percentage of the number of nearest neighbors */ double *xx; /* variable for the time series data */ double snr,SNR(); /* Signal-to-Noise ratio */ double max_snr; /* Maximam value of the SNR */ FILE *fp; /* reading parameters */ fp=fopen("parameters.txt","r"); if(fp==NULL){ fprintf(stderr,"parameter file not found.\n"); exit(0); } fscanf(fp,"%d %d",&length,&dim); fclose(fp); /* reading data from input file */ xx = (double*)calloc(length,sizeof(double)); fp=fopen("data.txt","r"); if(fp==NULL){ fprintf(stderr,"data file not found.\n"); exit(0); } for(i=0;i=right) return; for(i=left-1,j=right,pivot=*(x+right);;){ while(*(x+(++i)) < pivot); while(i < --j && pivot < *(x+j)); if(i >= j) break; y=*(x+i); *(x+i)=*(x+j); *(x+j)=y; k=*(order+i); *(order+i)=*(order+j); *(order+j)=k; } y=*(x+i); *(x+i)=*(x+right); *(x+right)=y; k=*(order+i); *(order+i)=*(order+right); *(order+right)=k; v=i; Quick_Sort(order,x,left,v-1); Quick_Sort(order,x,v+1,right); } void LPC_Estimate(dim,nnn,ss,nb,wd) int dim,nnn; double *ss; int *nb; double *wd; { int i,j,k,p; double Const; double Max; double *mx,*vc,*vt; vt=(double*)calloc(dim,sizeof(double)); vc=(double*)calloc(2*dim,sizeof(double)); mx=(double*)calloc(dim*2*dim,sizeof(double)); for(i=0;i