I am trying to perform fft in my below mentioned code but I am getting some errors which I will be mentioning at the bottom this code
#include<stdio.h>
#include<complex.h>
#include <gsl/gsl_integration.h>
#include"H.h"
#define REAL(z,i) ((z)[2*(i)])
#define IMAG(z,i) ((z)[2*(i)+1])
int
main (void)
{
gsl_integration_workspace * w
= gsl_integration_workspace_alloc (10000);
double qr,error;
double expected = -4.0;
double a1 = 1e-14;
double a= 150;//150;
double pi = 3.1415;
double T = 2500;
double b = (315777/(1000*T));
//printf("b = %f",b);
double mu = (2*pi)/b;
double om=7.15;
double om1=7.267;
int m;
for( m=1; m<11; m++)
{
double t = 4.14937*(m-1);
struct har item = {t,mu};
struct har *p_params = &item;
gsl_function q; //ok
q.function = &H;
q.params =&t;
gsl_integration_qags (&q, a1, a, 0,1e-7, 10000, w, &qr, &error);
printf ("\nqtresult = % .18f\n", qr);
}
gsl_integration_workspace_free (w);
}
user defined function H.h is as follows
#include"I.h"
#include"str.h"
double H (double x,void * params )
{
double t = *(double *) params;
//printf("%f\n",t);
//struct har t1,z;
//double t = z.params ->t1;
double H = I(x)*(sin(x*t));
return H;
}
structure file and I.h are as follows
double I(double x)
{
double gamma=0.182;
double tau=0.41493;
double om=7.1534;
double I=(gamma*x)/(pow((pow(om,2)-pow(x,2)),2)*(1+pow((x*tau),2))+(2*gamma*x*((pow(om,2)-pow(x,2))*x*tau)+pow((gamma*x),2)));
//double I = pow(x,2);
return I;
}
user defined function I.h is as follows
~
struct har{
double t;
double k;
double mu;
};
Above written code is running successfully until I don't include complex.h header file in code. After adding complex.h as a head file I am getting two errors which are as follows: 1. error : In file included from test.c:3:0: I.h:1:8: error: expected identifier or ‘(’ before ‘extension’ 2.called object is not a function or function pointer double
Please help me to resolve it out. Hoping you answer at earliest.
Thanks
Regards
Ramesh