Reply by feli...@hotmail.com●September 26, 20132013-09-26
Hi,
Check what the line "out[i]=out[i]*T;" is actually doing. I don����t
know how the operator "*" for fftw_complex* is defined. Also, T is double, so I
guess T is actually multiplying only the first double (real part) of the
complex out. It would distort the phase of the signal yielding weird things like
shrinking in time domain.
Best,
- Felipe
I'm an Italian university student. I'm trying to use FFTW libraries. I
have problems but I don't know in which forum I may ask help so I try here.
I wrote the following C program >
>#include
>#include
>#include
>#include
>
>void main()
>{
>int i;
>int N, num_points; // dimensione trasformata
>double T;
>double *in; // puntatore dati in ingresso alla FFT
>fftw_complex *out, *in2, *out2; // puntatore ai dati in uscita della FFT
>fftw_plan trasf_diretta, trasf_inversa;
>
>N=8;
>num_points=N/2+1;
>T=0.08;
>
>// allocazione memoria
>in = (double *) malloc(sizeof(double)*N);
>out = (fftw_complex *) fftw_malloc(sizeof(fftw_complex)*num_points);
>
>in[0]0000.0;
>in[1]000.0;
>in[2]`000.0;
>in[3]0000.0;
>in[4]=0.0;
>in[5]=0.0;
>in[6]=0.0;
>in[7]=0.0;
>
>// ffttw_plan_dft_r2c_1d (dimensione, segnale, risultato, flag
ottimizzazione)
>trasf_diretta = fftw_plan_dft_r2c_1d (N, in, out, FFTW_ESTIMATE);
>
>fftw_execute(trasf_diretta);
>
>for(i=0;i
Reply by bauzane●June 5, 20132013-06-05
I'm an Italian university student. I'm trying to use FFTW libraries. I
have problems but I don't know in which forum I may ask help so I try here.
I wrote the following C program
#include
#include
#include
#include
void main()
{
int i;
int N, num_points; // dimensione trasformata
double T;
double *in; // puntatore dati in ingresso alla FFT
fftw_complex *out, *in2, *out2; // puntatore ai dati in uscita della FFT
fftw_plan trasf_diretta, trasf_inversa;
N=8;
num_points=N/2+1;
T=0.08;
// allocazione memoria
in = (double *) malloc(sizeof(double)*N);
out = (fftw_complex *) fftw_malloc(sizeof(fftw_complex)*num_points);
The program compute forward FFT correctly but not inverse FFT because generate a
ifft compressed signal along x axis. I can't understand where the problem
is. Can anyone help me? Thank You Roberto