quarta-feira, fevereiro 23, 2011

prog2.c


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <complex.h>
#include <string.h>

#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
#include <gsl/gsl_vector_complex.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_fft_complex.h>

int main(void)
{
int N = 1024;
int i;
double Tmin, Tmax, deltaT;
double f,A, B, w;
double t[N], g[N], l[N], h[N];

Tmin = -16.0; /* 16 vezes Pi */
Tmax = 16.0;
deltaT = 32.0/N;
f = 2.0;
A = 1.0;
B = 0.01;
w = 0.04;

for ( i = 0 ; i < N ; i++ )
{
t[i] = (Tmin + i*deltaT)*2.0*M_PI;
g[i] = A*sin(f*t[i]);
}


for ( i = 0 ; i < N ; i++ )
{
h[i] = B*sin(w*t[i]);
}

for ( i = 0 ; i < N ; i++ )
{
l[i] = h[i]*g[i];
}

for ( i = 0 ; i < N ; i++ )
{
printf("%f\t%f\n", t[i], l[i]);
}


/* Kmin = -1/2*deltaX */
// Fmin = -N/64.0;
// Fmax = N/64.0;
// deltaF = 1.0/32.0;

/* Gerar um seno, com uma dada frequencia (2Hz, por exemplo) */


}

Nenhum comentário: