Author Topic: Hilbert Transform (Kramers Kronig Relations)  (Read 1267 times)

0 Members and 1 Guest are viewing this topic.

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
Hilbert Transform (Kramers Kronig Relations)
« on: April 07, 2020, 05:59:18 pm »
Hi All,

Is anyone here up to speed on the Kramers Kronig relations?

I just need a definition of what each of the terms mean (I already have an FFT of my signal):

The Kramers Kronig relations are stated as:

% for:
%      X(w) = X_1(w) + iX_2(w)
%
%       X_1(w) = (1/pi) * Cauchy_principle_value * integral ( X_2(w')/(w'^2 - w) dw')
%
%
%       X_2(w) = (-2w/pi) * Cauchy_principle_value * integral ( X_1(w')/(w'^2 - w) dw')

I don't get where I am supposed to find my Cauchy principle value, and  w' and dw' are supposed to represent?

Even if you can give me a link that has a worked example that would be fantastic - I have searched YouTube and Googled but everything I've found either gives me the formulas above or nothing.

Hilbert Transforms are the general heading under which Kramers Kronig relations fall in to, so even a good worked example where each of the components is worked out would be brilliant.

or a textbook reference

Many Thanks

 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4934
  • Country: vc
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #1 on: April 07, 2020, 10:14:08 pm »
..
% for:
%      X(w) = X_1(w) + iX_2(w)
%
%       X_1(w) = (1/pi) * Cauchy_principle_value * integral ( X_2(w')/(w'^2 - w) dw')
%
%
%       X_2(w) = (-2w/pi) * Cauchy_principle_value * integral ( X_1(w')/(w'^2 - w) dw')

I don't get where I am supposed to find my Cauchy principle value, and  w' and dw' are supposed to represent?
..

I think it should read:

% for:
%      X(w) = X_1(w) + iX_2(w)
%
%       X_1(w) = (1/pi) * Cauchy_principle_value [ Integral ( X_2(w')/(w'^2 - w) dw') ]
%
%
%       X_2(w) = (-2w/pi) * Cauchy_principle_value [ Integral ( X_1(w')/(w'^2 - w) dw') ]

You should calculate the Cauchy PV "of that Integral of the complex function", as the Integral has got a singularity (ie. a pole) in its complex function.

« Last Edit: April 07, 2020, 10:24:13 pm by imo »
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22029
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #2 on: April 07, 2020, 10:53:44 pm »
CPV isn't a coefficient?  It's supposed to be written as a specifier of the integral.  It is relevant when integrating around poles, as mentioned.

You're working with a series, so this becomes a summation instead, and all values are finite.

The derivatives may still prove troublesome; they become differences, and are sensitive to noise.  Both the difference and summation operations have various approximation methods available, to give more accurate or stable results from sampled data.  You may find these of interest:
https://en.wikipedia.org/wiki/Numerical_differentiation
https://en.wikipedia.org/wiki/Numerical_integration

There may also be an iterative process, where you can compute \$ X_1(\omega) \$ roughly, use it to compute \$ X_2(\omega) \$, and so on until the error margin is acceptably low.

\$ \omega^\prime \$ is the integration variable; note that \$ \omega \$ shows up in the expression as well.  Computation will be similar to convolution, i.e., you need to find the sum for each \$ \omega \$, and the set of results is your output; naively, an \$ O(N^2) \$ operation, but there are probably optimizations available.

But much more to the point -- why don't you use a complex FFT that produces X1 + iX2 directly? :o :o :o

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline mark03

  • Frequent Contributor
  • **
  • Posts: 723
  • Country: us
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #3 on: April 08, 2020, 12:46:27 am »
Also, it's "principal value," not "principle value."
 
The following users thanked this post: T3sl4co1l

Offline profdc9

  • Frequent Contributor
  • **
  • Posts: 332
  • Country: us
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #4 on: April 08, 2020, 02:43:09 am »
The Kramers-Kronig relations are the relations between the real and imaginary part of a function that is analytic in the upper half of the complex plane.

These functions are called "complex analytic signals."  The Fourier transform of a real-valued signal (that is, a signal representing a real quantity) has its negative frequencies being the complex conjugate of the positive ones, this is called Hermitian symmetry.

Because of this redundancy between the positive and negative frequencies, for frequencies that are known to only have positive or negative frequencies, for example, a signal on top of a carrier frequency, we can represent it by only its positive frequencies, and zero out the negative frequencies.  We can then define the "complex analytic signal" version of this real signal which is just a Fourier integral, but with the frequencies spanning from zero to +infinity rather than -infinity to +infinity.

This suggests a simple way to find the imaginary part of a complex analytic function from the real-value function (and vice versa).  If we have the real-valued function and we take its Fourier transform, this Fourier transform has Hermitian symmetry as mentioned above, that is, its negative frequency are the complex conjugate of the positive frequencies.  If we now zero out those negative frequencies, we have now transformed this signal to a complex analytic signal.  At the same time, the positive frequencies are multiplied by 2, and the zero frequency sample is left unchanged.

When we take the inverse Fourier tranform, the function now has the same real part as the original real-valued function, but the imaginary part is now the Hilbert transform of the real part.  So by using the Fourier transform / FFT, the complex analytic signal and therefore the Hilber transform is easily obtained.
 
The following users thanked this post: noname4me

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #5 on: April 08, 2020, 10:39:06 am »
Hi,

Thanks all for the replies.

Context:

I have performed an experiment in which I have measured the complex part of the KK relations, and wish to use it to calculate the real components.

Sample of dataset:

Wavelength, µm   n   k
0.5   2.693     0.0000121
0.52   2.65     0000043
0.54   2.62     0.0000015
0.56   2.596    8.00E-07
0.58   2.578    6.00E-07
0.6   2.56        5.00E-07
0.62   2.548     4.00E-07
0.64   2.537     4.00E-07
0.66   2.528     4.00E-07
0.68   2.521     3.00E-07


I've read some stuff which makes me believe that dw' is supposed to mean "take the  integral, and change the sign", kind of like adding the signum function on to the answer of the integral, but I don't know if it applies in this case?

In my specific case, I wanted to work out the X_1 component to give me an answer for the real component, and then validate using the second one, but I can't see how to apply it to the dataset in front of me.  In the above table, X_1 is the n column and X_2 is the k column.  This is from data where the 2 components are known, so I can tell if I have the right answer.  Imagine at this point that the n column does not exist.

(apologies, yes it is principal, not principle - put it down to frazzled brain :))

Regarding the Cauchy Principal Value -  I know I need to calculate the residue around some point Z_0, but I don't have a function so to speak - I have just a dataset.  I could do a Laurent series expansion around one point on the dataset (wavelength), setting the point under consideration as Z_0, and all the other points as Z and then using that to work out the CPV? Is that a valid approach?  I don't know what the singularity would be in the dataset given that I'm supposed to be able to apply this across the wavelengths and get an answer.

The w I take to represent the k point from my dataset corresponding to the wavelength under consideration (is this valid?), so would w' be taken as the tangent to that point, worked out by looking at the 2 points either side, fitting a quadratic to it, and taking the tangent of this?

I know this is a bit heavy going, so I appreciate the effort for any assistance you can give.

(I'm using MATLAB to perform my analysis, so I'm not over worried about the tedium in working out)

Thanks
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22029
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #6 on: April 08, 2020, 11:00:55 am »
\$ d \omega^\prime \$ is the variable being integrated.  It doesn't say to do anything with the integral; it's part of the integration operator.

Signum is a piecewise continuous function (or discontinuous depending on definition), it's probably not a great idea in an integral, or a signals application.  Not sure where you'd be thinking of it from...  The unit step, often shows up in Laplace transforms; partly by convention, because it's a one-sided integral anyway (the most common form of it, that is).  Or the absolute function, is prominent in math in general, but is poorly behaved in complex analysis (it's not analytic).

CPV is only needed when the integrand contains indeterminate poles.  When it has none in the integration range, it's simply the ordinary integration process.

Again, your data are discrete and finite, we can safely conclude there are no poles in it.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: noname4me

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4934
  • Country: vc
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #7 on: April 08, 2020, 11:23:11 am »
CPV isn't a coefficient?  It's supposed to be written as a specifier of the integral.  It is relevant when integrating around poles, as mentioned.

An example: first is the CPV of the integral, the second is the integral (wolfram alpha):

« Last Edit: April 08, 2020, 11:25:43 am by imo »
 
The following users thanked this post: T3sl4co1l, noname4me

Offline noname4meTopic starter

  • Regular Contributor
  • *
  • Posts: 93
Re: Hilbert Transform (Kramers Kronig Relations)
« Reply #8 on: April 08, 2020, 02:00:28 pm »
Thanks guys - its clearer now.

I'll cogitate on this for a bit before trying to write my own function - but certainly this has helped enormously!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf