Instituto

Páginas: 4 (842 palabras) Publicado: 27 de noviembre de 2012
// Fourier series routines
#include <math.h>

#define MAXITER 15

double om;
double PI =3.1415926535;
int flag;

// analytical function to study:
// ----------------------------
// Note: Exact Fouriercoefficients for this periodic function are:
// an=0 if n is even, -1/2n if n=4p+1, 1/2n if n=4p+3
// bn=0 if n=4p, -1/2n if n=4p+1, 1/n if n=4p+2, -1/2n if n=4p+3//----------------------------------------------------------------
double F(double x) {
if (x<-PI) return 0.0;
else if(x<-PI/2) return PI/4;
else if (x<=PI) return -PI/4;
else return 0.0;
}

// Function to integrate byRomberg method
double FUNC(double x) {
if (!flag) return (F(x)*cos(om*x)); //for an
else return (F(x)*sin(om*x)); //for bn}

/***************************************************************
* Calculate the Fourier harmonic #n of a periodic discreet*
* function F(x) defined by ndata points. *
* ------------------------------------------------------------ *
* Inputs:*
* ndata: number of points of discreet function. *
* X : pointer to tablestoring xi abscissas. *
* Y : pointer to table storing yi ordinates. *
* *...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • instituto
  • Instituto
  • instituto
  • instituto
  • instituto
  • Instituto lo
  • INSTITUTO
  • INSTITUTO

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS