DSPRelated.com
Forums

Ways of implementing a Hilbert Transform

Started by Michel Rouzic January 11, 2006
Michel Rouzic wrote:

> Martin Eisenberg wrote:
>> Michel, I suggest you start a new thread with a title like >> "Ways of handling a chirp" or whatever you find appropriate and >> describe in detail the problem, not what you think is the >> solution.
> I already did that actually, it was mainly about discussing of > how to make a bandpass filter that varies over time, because > then I had absolutly no idea on how to do it.
OK, but none of the respondents was clear about the fact that your signal is complex and where you want to go, so I think it would help to put all the bits and pieces you told throughout this thread in one place. If you're talking about a former thread here, you might refer to that.
>> The FFTW manual says so in section 4.7.1. > > "this means that the positive frequencies are stored in the > first half of the output and the negative frequencies are stored > in backwards order in the second half of the output." > > Wow... wtf. I thought that the first half of the output was the > real part, and the second half was the imaginary part backwards. > All my certainities are collapsing. Now i'm in the most complete > confusion. Does it mean that the imaginary part == the negative > frequencies?
Not at all. The output is an array of complex numbers (pairs of doubles) each of wich holds the real and imaginary part of one frequency bin. See section 4.1.1. Have you read Rick's Appendix C?
> if the nyquist frequency is 0.5, does a cosine @ 0.85 > become by aliasing a sine @ 0.15?
No, it becomes a cosine at -0.15 which is the same as a cosine at +0.15. Assuming that t = 0 is a sampling instant sines must stay sines and cosines stay cosines. However, an aliased sine's phase may change by pi radians as in Rick's fig. 2-2 (to connect this with my sine example, note that obviously sin(-2 Hz * t) = -sin(2 Hz * t)); more generally, an aliased complex exponential may change its sense of turning. It depends on how often the aliased frequency wraps around. Martin -- Quidquid latine scriptum sit, altum viditur.
Jerry Avins wrote:

> > The drowning girl will remark how pretty the coral. > > --Sara Swanson, Malignant
> My thought as I saw the surface receding above me was, "Damn! > The grownups lied again!"
Glad you made it! The quote is from a piece in The Bend vol. 2, a publication of the University Of Notre Dame's Creative Writing Program. If you're into poetry and poetic prose, it's good. It lives at http://www.nd.edu/~alcwp/The%20Bend/Index.html . Martin -- Quidquid latine scriptum sit, altum viditur.
Martin Eisenberg wrote:
> Jerry Avins wrote: > > >>>The drowning girl will remark how pretty the coral. >>>--Sara Swanson, Malignant > > >>My thought as I saw the surface receding above me was, "Damn! >>The grownups lied again!" > > > Glad you made it! The quote is from a piece in The Bend vol. 2, a > publication of the University Of Notre Dame's Creative Writing > Program. If you're into poetry and poetic prose, it's good. It lives > at http://www.nd.edu/~alcwp/The%20Bend/Index.html .
I wouldn't have had I panicked. I let most of the air to bear better against the bottom, then walked toward shore. After a while I jumped, got my head out, took a few quick breaths, and went down again. I broke surface sometime after the third jump and walked up the beach. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On 14 Jan 2006 03:08:07 -0800, "Andor" <andor.bariska@gmail.com>
wrote:

>Rick Lyons wrote: > >... >> One way to generate an analytic signal is to perform the FFT of your >> original real signal. Next, zero-out all of the FFT results negative >> frequency components. (This will give you a spectrum having only >> positive-frequency components.) Then perform the inverse FFT of that >> new spectrum. The result of the inverse FFT will be your desired >> analytic signal, and the real part of the analytic signal will be the >> original a real signal samples that you started with. > >Rick, I tried out this procedure. It turned out that, in addition to >what you describe, I had to scale the DC and the Nyquist term of the >spectrum (both real only due to Hermitian symmetry) by a factor of 1/2 >to get the desired result. > >I've never used the Hilbert transform before. I understand that it can >be used to determine "instantaneous" amplitude (magnitude of the >Hilbert transform pair) and frequency (rate of change of the phase of >the Hilbert transfrom pair) of a time signal. Zeno would have a feast >with that :-) ! > >In what type of processing are we interested in that information? > >Regards, >Andor
Hi Andor, I think there are many applications for the Hilbert transform. The two applications that spring to my mind right away are in communications systems. If we have a complex signal (the real part being some original real signal, and the imaginary part being the Hilbert xform of the original real part), we can perform FM demodulation in a fairly straightforward manor by taking the derivative of the instantaneous phase of the complex signal sequence. This, it seems to me, is easier than performing FM demod on real-only signals. Given that same complex signal, high performance AM demodulation can be performed by merely computing the magnitude of the complex signal sequence. [-Rick-]
Hi All,

I wonder how many times we have discussed this issue. There have been
numerous threads on Hilbert transform one of which was even initiated
by me. To avoid this problem repeat questions, I have got a suggestion
to make.

1. There are quite a few generic topics similar to Hilber transfrom
which are posted too often. Let's perpare a complete tutorial on those
topics using all the relevant comments of the authors in the thread.
This will not only provide a complied and consolidated answer to
frequent questions but also save a lot of time of the busy people like
Rick.

2. In that case, group will be able to concentrate on the customized
and specialised problems posted by the users.

I can volunteer for the Job but only if you all agree and support me. (
I am a PhD student and doing research in Computer vision area)

Thanks
Ajay

Ajay wrote:
> Hi All, > > I wonder how many times we have discussed this issue. There have been > numerous threads on Hilbert transform one of which was even initiated > by me. To avoid this problem repeat questions, I have got a suggestion > to make. > > 1. There are quite a few generic topics similar to Hilber transfrom > which are posted too often. Let's perpare a complete tutorial on those > topics using all the relevant comments of the authors in the thread. > This will not only provide a complied and consolidated answer to > frequent questions but also save a lot of time of the busy people like > Rick. > > 2. In that case, group will be able to concentrate on the customized > and specialised problems posted by the users. > > I can volunteer for the Job but only if you all agree and support me. ( > I am a PhD student and doing research in Computer vision area)
I don't know what kind of support you expect if you will do the writing, but I will be willing to edit for clarity. Maybe the result can be an appendix to the FAQ, maybe http://dspguru.com/comp.dsp/index.htm is the place for it. I can give it room on my site as long as I have it. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Martin Eisenberg wrote:
> >> The FFTW manual says so in section 4.7.1. > > "this means that the positive frequencies are stored in the > > first half of the output and the negative frequencies are stored > > in backwards order in the second half of the output." > > > > Wow... wtf. I thought that the first half of the output was the > > real part, and the second half was the imaginary part backwards. > > All my certainities are collapsing. Now i'm in the most complete > > confusion. Does it mean that the imaginary part == the negative > > frequencies? > > Not at all. The output is an array of complex numbers (pairs of > doubles) each of wich holds the real and imaginary part of one > frequency bin. See section 4.1.1. Have you read Rick's Appendix C?
There's some confusion here because FFTW supports at least three data formats for FFTs. One is when the inputs are complex data, in which case the output is a complex array of the positive freqs followed by the negative freqs as described in the above quotation (this format is almost universal for complex-data FFT codes). The other two formats are optimized for real inputs. In this case the negative and positive frequency components are redundant so FFTW only outputs the positive-freq components. It can either output them as N/2+1 complex numbers in the usual real/imag format, or as the real parts followed by the imaginary parts in reverse order. (The latter has some algorithmic advantages, at least for odd sizes.) Cordially, Steven G. Johnson
Jerry Avins wrote:
> Michel Rouzic wrote: > > ... > > > I already did that actually, it was mainly about discussing of how to > > make a bandpass filter that varies over time, because then I had > > absolutly no idea on how to do it. Basically two main ideas for doing > > this came out, performing some time-domain convolution with a bandpass > > FIR kernel that would change for every sample to adapt it's > > frequencies, and the other one was to shift the frequency of the chirp > > in order to make it flat. And I wanted to implement that following the > > schema shown above, but I didn't know how to deal with that Hilbert > > Transform thing and most of all I wanted to understand it (along with > > negative frequencies so I could understand analytic signals as well) so > > that's why I did this topic about all that. > > Instead of a bandpass filter that varies with time, you can record the > results of the chirp already shifted to DC and environs, so that a fixed > lowpass filter does the same job. It's much easier that way.
you mean, not actually record a chirp? I need to record a chirp so I can know the frequency response of a system. and it's the only way, because since my system is too noisy, a white sound wouldn't do it, as i can filter out noise of a chirp "easily"
> >>Now I can also tell you what FFTW does: it is a common convention for > >>FFT codes to order bins by positive frequency in the range > >>[0, 2*pi], so the upper half of the output array holds the components > >>at negative frequencies of decreasing absolute value. The FFTW manual > >>says so in section 4.7.1. > > > > > > "this means that the > > positive frequencies are stored in the first half of the output and the > > negative frequencies > > are stored in backwards order in the second half of the output." > > > > Wow... wtf. I thought that the first half of the output was the real > > part, and the second half was the imaginary part backwards. All my > > certainities are collapsing. Now i'm in the most complete confusion. > > Does it mean that the imaginary part == the negative frequencies? the > > cosines are in positive frequencies and the sines are in negative > > frequencies? if the nyquist frequency is 0.5, does a cosine @ 0.85 > > become by aliasing a sine @ 0.15? > > There are various ways to program FFTs. You need to read the specs of > whichever you use to know if it's real in / complex out, complex in / > complex out, where zero frequency is in the arrays, and the storage > order in general. Decimation in time and decimation in frequency lead to > different arrays with the same results. The one constant is that > negative and imaginary frequencies are not interchangeable. > > Basically, you need to understand the tools you use. If you have th > books I mentioned before, read them in detail and work out a few examples.
Right now I rather have the feeling that I have to understand the theories I use. Plus, as for the FFTW result, it always worked right by considerintg the first part of the output real and the second half imaginary, the best evidence of it is that I can turn that output to polar form. So if it also says that the first half of the output is positive and the second is negative, the only expalaination I see is that negative frequencies==imaginary frequencies
"Rick Lyons" <R.Lyons@_BOGUS_ieee.org> wrote in message 
news:43cb0cf4.38331937@news.sf.sbcglobal.net...
> > If we have a complex signal (the real part being some > original real signal, and the imaginary part being > the Hilbert xform of the original real part), > we can perform FM demodulation in a fairly > straightforward manor
[manner ;-)]
> by taking the derivative of > the instantaneous phase of the complex signal sequence. > This, it seems to me, is easier than performing > FM demod on real-only signals.
I'm lost :-( Did you mean: 1. Sample the RF signal (call it the real part). 2. Create an imaginary "friend" for (1) by applying the HT to (1). 3. Compute the "phase" at each point in the result of (2) from atan2(realpart, imagpart) 4. Put the result of 3 through a digital differentiator. I'm understanding that all steps are applied to the time-domain signal. Is that correct?
Michel Rouzic wrote:
> Jerry Avins wrote: > >>Michel Rouzic wrote: >> >> ... >> >> >>>I already did that actually, it was mainly about discussing of how to >>>make a bandpass filter that varies over time, because then I had >>>absolutly no idea on how to do it. Basically two main ideas for doing >>>this came out, performing some time-domain convolution with a bandpass >>>FIR kernel that would change for every sample to adapt it's >>>frequencies, and the other one was to shift the frequency of the chirp >>>in order to make it flat. And I wanted to implement that following the >>>schema shown above, but I didn't know how to deal with that Hilbert >>>Transform thing and most of all I wanted to understand it (along with >>>negative frequencies so I could understand analytic signals as well) so >>>that's why I did this topic about all that. >> >>Instead of a bandpass filter that varies with time, you can record the >>results of the chirp already shifted to DC and environs, so that a fixed >>lowpass filter does the same job. It's much easier that way. > > > you mean, not actually record a chirp? I need to record a chirp so I > can know the frequency response of a system. and it's the only way, > because since my system is too noisy, a white sound wouldn't do it, as > i can filter out noise of a chirp "easily"
You use the chirp to probe the frequency response of the system. You don't need to record it, only the result. By beating the returned signal with (both phases of) the oscillator that drives the loudspeaker, all the information you want is recorded as a DC amplitude, with noise as AC, and a double-frequency component above that. A fixed low-pass filter removes all the garbage. Think about it. You now plan to record the returned chirp, convert it to a fixed frequency, then bandpass that signal. If the fixed frequency you chose were DC, then a low-pass filter would do instead. You need I and Q signals to do the frequency conversion, hence the Hilbert transform. If You do the conversion at the time the data are recorded, you already have quadrature information: the two-phase oscillator. For more insight, look up "lock-in amplifier". ...
>>Basically, you need to understand the tools you use. If you have the >>books I mentioned before, read them in detail and work out a few examples. > > > Right now I rather have the feeling that I have to understand the > theories I use.
You need both.
> Plus, as for the FFTW result, it always worked right by > considerintg the first part of the output real and the second half > imaginary, the best evidence of it is that I can turn that output to > polar form. So if it also says that the first half of the output is > positive and the second is negative, the only expalaination I see is > that negative frequencies==imaginary frequencies
The correct explanation (the one you didn't see) is that you got the wrong results and didn't know it. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;