/********************************************************* * This program calculates the Fourier coefficients of a * * periodic analytic function F(x) by using the procedure * * AnalyticFourierHn of file fourier.cpp and draws the * * reconstructed signal from Fourier coefficients. * * ------------------------------------------------------ * * SAMPLE RUN: * * * * F(x) = 0 from -pi to 0 and sin(x) from 0 to pi * * (one period). * * * * Lowest harmonic: 0 * * Highest harmonic: 25 * * * * A graph is displayed (reconstructed curve F(x) with * * 25 harmonics). * * * * C++ version in API style by J-P Moreau, Paris. * * (www.jpmoreau.fr) * ********************************************************** Used files: ganafour.mak, basis_r.cpp, fourier.cpp, graph2d.cpp, vmblock.cpp basis.h, graph2d.h, vmblock.h --------------------------------------------------------*/ #include #include #include // ABS, REAL etc. #include HDC hdc; RECT rect; HPEN hpen, hpenOld; //Functions used here of graph2D.cpp void CourbeXY(int,int,float *,double,double); void Legendes (int,char *,char *,char *,int,int,char *,int,int,char *); //Function of fourier.cpp void AnalyticFourierHn(REAL,REAL,int,REAL *,REAL *); //"home made" graphic commands for hdc environment used by above functions void DrawPixel(int ix,int iy) { //sorry, no other available command found Rectangle(hdc,rect.left+ix,rect.top+iy, rect.left+ix+2,rect.top+iy+1); } void Swap(int *i1,int *i2) { int it; it=*i1; *i1=*i2; *i2=it; } void DrawLine(int ix1,int iy1,int ix2,int iy2) { int i,il,ix,iy; double dx,dy; if (ix2