Skip to main content
deleted 10 characters in body
Source Link

------edit-------UPDATE:

------edit-------

UPDATE:

deleted 37 characters in body
Source Link

The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (lowerred), Output (uppergreen)): Input/Output signal to prove that FFT worksFFT iFFT

Yet, with the phase shift I get this result (Original (lowerred), Hilbert transformed Output (uppergreen)): Input/Output signal to prove that Hilbert trafo does not workInput/Output signal to prove that Hilbert trafo does not work

The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (lower), Output (upper)): Input/Output signal to prove that FFT works

Yet, with the phase shift I get this result (Original (lower), Hilbert transformed Output (upper)): Input/Output signal to prove that Hilbert trafo does not work

The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (red), Output (green)): FFT iFFT

Yet, with the phase shift I get this result (Original (red), Hilbert transformed Output (green)): Input/Output signal to prove that Hilbert trafo does not work

added 1722 characters in body
Source Link

------edit-------

So I coded the Hilbert transformation in $C$ but unfortunately I do not get a phase shift of $90^\circ$ but somewhat different from that and with a wrong amplitude. My code looks like this:

    void hilbertfun(float *vin, float *vout, int n, int d)
    {
static complex *A;           //working array
int i;
float pi = 4. * atan(1.);
int signfun;
static float *rkx;

void rk(float *ak, int n, float d, int ind);

A  = (complex*) alloc1(n,sizeof(complex));
rkx = (float*) alloc1(n,sizeof(float));

//copy input array to complex array
for(i=0; i<n; i++){
    A[i].r = vin[i];
    A[i].i = 0.;
}

// perform inverse fft
fouriertransform(1,n,A);

// calculate wavenumbers
wavenumbers(rkx,n,d,1);



// check wether wavenumbers are positive or negative >> apply phase shift by using the impulse response of the Hilbert transformer
// + apply phase shift
for(i=0;i<n;i++){
  if (rkx[i] > 0) signfun = 1;
  else if (rkx[i] == 0) signfun = 0;
  else if (rkx[i] < 0) signfun = -1;
    A[i].r = - A[i].i * signfun;
    A[i].i = A[i].r * signfun;
}

// perform forward fft
fouriertransform(-1,n,A);

for(i=0;i<n;i++) vout[i]=A[i].r/n; //write into output and normalise

}

The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (lower), Output (upper)): Input/Output signal to prove that FFT works

Yet, with the phase shift I get this result (Original (lower), Hilbert transformed Output (upper)): Input/Output signal to prove that Hilbert trafo does not work

What am I missing?

------edit-------

So I coded the Hilbert transformation in $C$ but unfortunately I do not get a phase shift of $90^\circ$ but somewhat different from that and with a wrong amplitude. My code looks like this:

    void hilbertfun(float *vin, float *vout, int n, int d)
    {
static complex *A;           //working array
int i;
float pi = 4. * atan(1.);
int signfun;
static float *rkx;

void rk(float *ak, int n, float d, int ind);

A  = (complex*) alloc1(n,sizeof(complex));
rkx = (float*) alloc1(n,sizeof(float));

//copy input array to complex array
for(i=0; i<n; i++){
    A[i].r = vin[i];
    A[i].i = 0.;
}

// perform inverse fft
fouriertransform(1,n,A);

// calculate wavenumbers
wavenumbers(rkx,n,d,1);



// check wether wavenumbers are positive or negative >> apply phase shift by using the impulse response of the Hilbert transformer
// + apply phase shift
for(i=0;i<n;i++){
  if (rkx[i] > 0) signfun = 1;
  else if (rkx[i] == 0) signfun = 0;
  else if (rkx[i] < 0) signfun = -1;
    A[i].r = - A[i].i * signfun;
    A[i].i = A[i].r * signfun;
}

// perform forward fft
fouriertransform(-1,n,A);

for(i=0;i<n;i++) vout[i]=A[i].r/n; //write into output and normalise

}

The Fourier transform and the normalisation work perfectly fine without the phase shift (Original (lower), Output (upper)): Input/Output signal to prove that FFT works

Yet, with the phase shift I get this result (Original (lower), Hilbert transformed Output (upper)): Input/Output signal to prove that Hilbert trafo does not work

What am I missing?

added 9 characters in body
Source Link
Loading
Source Link
Loading