DSPRelated.com
Forums

hilbert transform application

Started by sundar July 21, 2004
Hello everyone,

To begin with I would like to express my gratitude to the countless
number of people who have been helping me indirectly over the last few
months. This is my first post in this group and I am sure I will not
be disappointed.  I am new to the field of DSP no courses ever taken,
but working with it now.
 
I have a data set that has been sampled at a rate of 44khz for a
minute. By doing a 2048 fft with 50% overlap and a hanning window, I
have obtained the average power spectrum which clearly indicates the 3
different tonal that I am looking for.
 
My problem is that I "need" to use Hilbert transform, I am lost I have
been following the posts in this group to make out that the signal
envelope is abs (Hilbert(signal), but still I am not sure how to apply
it. Do I use the data before doing a fft or after doing one. I need to
obtain the instantaneous phase, frequency. Secondly, I know that phase
is unwrap (angle (data)), but again, how do I apply it.

I know this may sound too simple or too dumb, anyway I was looking for
any help. Any kind of advice is appreciated.

Thanks

Sundar
Hi Sundar,

On 2004-07-22 00:48:40 +0200, snsundar@olemiss.edu (sundar) said:

> I have a data set that has been sampled at a rate of 44khz for a > minute. By doing a 2048 fft with 50% overlap and a hanning window, I > have obtained the average power spectrum which clearly indicates the 3 > different tonal that I am looking for.
There is no such thing as a "Hanning" window (even though the literature is full of this misconception). The thing you're referring to is called a "Hann" or "von Hann" window.
> My problem is that I "need" to use Hilbert transform, I am lost. I have > been following the posts in this group to make out that the signal > envelope is abs (Hilbert(signal), but still I am not sure how to apply > it.
I don't think that this is correct. You should calculate it using the analytic signal's magnitude env = sqrt(sig*sig + hilb*hilb), probably with some lowpass filtering to remove HF detail (for example, if you're using it for AGC/dynamic range compression/limiting). I am assuming here that you're talking about the time domain amplitude envelope (which is how I read your post).
> Do I use the data before doing a fft or after doing one.
After applying the FFT you're dealing with the Fourier transform of your signal. Unless you want to calculate the "spectral envelope" of the signal (which isn't entirely clear from your post) you need to mess around with your time domain data *before* the Fourier transform (or, after doing the inverse). You can calculate the Hilbert transformed signal using the FFT though, by zeroing out the negative frequencies and multiplying by 2 before doing the inverse transform.
> I need to > obtain the instantaneous phase, frequency. Secondly, I know that phase > is unwrap (angle (data)), but again, how do I apply it.
Without knowing what you want to achieve I believe this cannot be answered. On my web site (in the "Pitch Shifting using the Fourier Transform" article) I calculate the unwrapped phase as part of the process. Maybe looking at it (http://www.dspdimension.com) helps you out. -- Stephan M. Bernsee http://www.dspdimension.com
Hi Stephan , 

Thanks a ton for your input. I went to your website and spent some
usefull time on the articles that were posted on it.

Iam now a little more clear as to where iam heading. ok so getting
back to where i was . Iam trying to find the instantaneous frequency
by using hilbert transforms. this is where i stand.

I took the data and did a 44100 fft on it and got a spectrum showing
my 3 lovely tonals. Next i took the frequency of interest and zeroed
the rest of the  data. And this new spectrum gave me a single peak ,
while the rest of the points are zero. Followed by this i did a ifft.
Am i right so far?

Is now the abs of my ifft my envelope and how do i proceed from here.

Once again thanks a ton.Any advice from any source is appreciated.

Regards

Sundar 





Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2m94hlFjkjbdU1@uni-berlin.de>...
> Hi Sundar, > > On 2004-07-22 00:48:40 +0200, snsundar@olemiss.edu (sundar) said: > > > I have a data set that has been sampled at a rate of 44khz for a > > minute. By doing a 2048 fft with 50% overlap and a hanning window, I > > have obtained the average power spectrum which clearly indicates the 3 > > different tonal that I am looking for. > > There is no such thing as a "Hanning" window (even though the > literature is full of this misconception). The thing you're referring > to is called a "Hann" or "von Hann" window. > > > My problem is that I "need" to use Hilbert transform, I am lost. I have > > been following the posts in this group to make out that the signal > > envelope is abs (Hilbert(signal), but still I am not sure how to apply > > it. > > I don't think that this is correct. You should calculate it using the > analytic signal's magnitude env = sqrt(sig*sig + hilb*hilb), probably > with some lowpass filtering to remove HF detail (for example, if you're > using it for AGC/dynamic range compression/limiting). I am assuming > here that you're talking about the time domain amplitude envelope > (which is how I read your post). > > > Do I use the data before doing a fft or after doing one. > > After applying the FFT you're dealing with the Fourier transform of > your signal. Unless you want to calculate the "spectral envelope" of > the signal (which isn't entirely clear from your post) you need to mess > around with your time domain data *before* the Fourier transform (or, > after doing the inverse). > > You can calculate the Hilbert transformed signal using the FFT though, > by zeroing out the negative frequencies and multiplying by 2 before > doing the inverse transform. > > > I need to > > obtain the instantaneous phase, frequency. Secondly, I know that phase > > is unwrap (angle (data)), but again, how do I apply it. > > Without knowing what you want to achieve I believe this cannot be > answered. On my web site (in the "Pitch Shifting using the Fourier > Transform" article) I calculate the unwrapped phase as part of the > process. Maybe looking at it (http://www.dspdimension.com) helps you > out.
Hi Sundar,

I have some more questions for you because I'm afraid your description 
is still a bit vague:

On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said:

> Iam now a little more clear as to where iam heading. ok so getting > back to where i was . Iam trying to find the instantaneous frequency > by using hilbert transforms. this is where i stand.
The instantaneous frequency of what exactly are you trying to determine? Your time domain sequence? Some frequency range of that sequence? One particular frequency? And where is the connection to your time domain amplitude envelope? -- Stephan M. Bernsee http://www.dspdimension.com
hi Stephen,

Iam sorry for the vagueness in my description, thats because honestly
iam little lost in this place, and trying hard to stay afloat.

Ok i am trying to find how my one particular frequency changes with
time.Does that make sense....?..

also i was trying to get a envelope of my time domain signal.

regards. 

sundar
 

Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2md87gFllv9hU1@uni-berlin.de>...
> Hi Sundar, > > I have some more questions for you because I'm afraid your description > is still a bit vague: > > On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said: > > > Iam now a little more clear as to where iam heading. ok so getting > > back to where i was . Iam trying to find the instantaneous frequency > > by using hilbert transforms. this is where i stand. > > The instantaneous frequency of what exactly are you trying to > determine? Your time domain sequence? Some frequency range of that > sequence? One particular frequency? > > And where is the connection to your time domain amplitude envelope?
Hi sundar,

What is confusing me in your description is the nature of the three
"tonals" (I assume you mean sinusoids). Are they separated in
frequency by a known minimum? If so, then you can perform the
operations I think you desire by first bandpass-filtering the input to
isolate the one frequency of interest, then performing the Hilbert
transform on the result to get y[n] = A[n]e^(j*theta), where 
theta = j*2*pi*f*n*T + phi). Computing (theta[n] - theta[n-1]) / T 
of y[n] gives the instantaneous frequency, A[n] is the envelope.

--RY

snsundar@olemiss.edu (sundar) writes:

> hi Stephen, > > Iam sorry for the vagueness in my description, thats because honestly > iam little lost in this place, and trying hard to stay afloat. > > Ok i am trying to find how my one particular frequency changes with > time.Does that make sense....?.. > > also i was trying to get a envelope of my time domain signal. > > regards. > > sundar > > > Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2md87gFllv9hU1@uni-berlin.de>... >> Hi Sundar, >> >> I have some more questions for you because I'm afraid your description >> is still a bit vague: >> >> On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said: >> >> > Iam now a little more clear as to where iam heading. ok so getting >> > back to where i was . Iam trying to find the instantaneous frequency >> > by using hilbert transforms. this is where i stand. >> >> The instantaneous frequency of what exactly are you trying to >> determine? Your time domain sequence? Some frequency range of that >> sequence? One particular frequency? >> >> And where is the connection to your time domain amplitude envelope?
-- % Randy Yates % "So now it's getting late, %% Fuquay-Varina, NC % and those who hesitate %%% 919-577-9882 % got no one..." %%%% <yates@ieee.org> % 'Waterfall', *Face The Music*, ELO http://home.earthlink.net/~yatescr
hi everyone, I know most of you by now must have gone mad with my
posts and endless silly queries. Well the bad news is that i have some
more.

i read this in an report and am trying to follow this. 

I have a time domain signal, do a fft and get into freq domain. Then
take the freq bin of interest and zero out the rest of the
frequencies. Then i do my ifft for this filtered signal. lets say this
output is A. Then if i rotate my filtered signal , by pi/2 and then do
my ifft on it. we get say output B. Both A and B are complex outputs,
and A is the real while B is the imaginary part and can be used to
calculate the magnitude and phase.

does this sound ok to you all. 

Waiting for some help.

Regards

Sundar





Randy Yates <yates@ieee.org> wrote in message news:<y8l7iza7.fsf@ieee.org>...
> Hi sundar, > > What is confusing me in your description is the nature of the three > "tonals" (I assume you mean sinusoids). Are they separated in > frequency by a known minimum? If so, then you can perform the > operations I think you desire by first bandpass-filtering the input to > isolate the one frequency of interest, then performing the Hilbert > transform on the result to get y[n] = A[n]e^(j*theta), where > theta = j*2*pi*f*n*T + phi). Computing (theta[n] - theta[n-1]) / T > of y[n] gives the instantaneous frequency, A[n] is the envelope. > > --RY > > snsundar@olemiss.edu (sundar) writes: > > > hi Stephen, > > > > Iam sorry for the vagueness in my description, thats because honestly > > iam little lost in this place, and trying hard to stay afloat. > > > > Ok i am trying to find how my one particular frequency changes with > > time.Does that make sense....?.. > > > > also i was trying to get a envelope of my time domain signal. > > > > regards. > > > > sundar > > > > > > Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2md87gFllv9hU1@uni-berlin.de>... > >> Hi Sundar, > >> > >> I have some more questions for you because I'm afraid your description > >> is still a bit vague: > >> > >> On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said: > >> > >> > Iam now a little more clear as to where iam heading. ok so getting > >> > back to where i was . Iam trying to find the instantaneous frequency > >> > by using hilbert transforms. this is where i stand. > >> > >> The instantaneous frequency of what exactly are you trying to > >> determine? Your time domain sequence? Some frequency range of that > >> sequence? One particular frequency? > >> > >> And where is the connection to your time domain amplitude envelope?
Isn't the IFFT of a single non-zero "bin" something you can write by
inspection? Don't let details of the math isolate you from the reality
of what you're trying to do.

You're twisting yourself around to the point that, while you may know
what you mean, you aren't communicating well. That shows very clearly
when you write, "Both A and B are complex outputs, and A is the real
while B is the imaginary ..."

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;
sundar wrote:

> hi everyone, I know most of you by now must have gone mad with my > posts and endless silly queries. Well the bad news is that i have some > more. > > i read this in an report and am trying to follow this. > > I have a time domain signal, do a fft and get into freq domain. Then > take the freq bin of interest and zero out the rest of the > frequencies. Then i do my ifft for this filtered signal. lets say this > output is A. Then if i rotate my filtered signal , by pi/2 and then do > my ifft on it. we get say output B. Both A and B are complex outputs, > and A is the real while B is the imaginary part and can be used to > calculate the magnitude and phase. > > does this sound ok to you all. > > Waiting for some help. > > Regards > > Sundar > > > > > > Randy Yates <yates@ieee.org> wrote in message news:<y8l7iza7.fsf@ieee.org>... > >>Hi sundar, >> >>What is confusing me in your description is the nature of the three >>"tonals" (I assume you mean sinusoids). Are they separated in >>frequency by a known minimum? If so, then you can perform the >>operations I think you desire by first bandpass-filtering the input to >>isolate the one frequency of interest, then performing the Hilbert >>transform on the result to get y[n] = A[n]e^(j*theta), where >>theta = j*2*pi*f*n*T + phi). Computing (theta[n] - theta[n-1]) / T >>of y[n] gives the instantaneous frequency, A[n] is the envelope. >> >>--RY >> >>snsundar@olemiss.edu (sundar) writes: >> >> >>>hi Stephen, >>> >>>Iam sorry for the vagueness in my description, thats because honestly >>>iam little lost in this place, and trying hard to stay afloat. >>> >>>Ok i am trying to find how my one particular frequency changes with >>>time.Does that make sense....?.. >>> >>>also i was trying to get a envelope of my time domain signal. >>> >>>regards. >>> >>>sundar >>> >>> >>>Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2md87gFllv9hU1@uni-berlin.de>... >>> >>>>Hi Sundar, >>>> >>>>I have some more questions for you because I'm afraid your description >>>>is still a bit vague: >>>> >>>>On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said: >>>> >>>> >>>>>Iam now a little more clear as to where iam heading. ok so getting >>>>>back to where i was . Iam trying to find the instantaneous frequency >>>>>by using hilbert transforms. this is where i stand. >>>> >>>>The instantaneous frequency of what exactly are you trying to >>>>determine? Your time domain sequence? Some frequency range of that >>>>sequence? One particular frequency? >>>> >>>>And where is the connection to your time domain amplitude envelope?
Hi jerry 

Thank you for your point  and apologies for my communication problem. 

ok iam rewritting what i read....

"The inverse FFT was taken out of the signal both before and after the
hilbert transform was applied. A complex time series was then formed
in which the real part was the inverse FFT of the signal and the
imaginery part was the inverse part of the hilbert transformed signal
.The magnitude and phase were calculated directly from this complex
signal. "

If this sound more clear , i would appreciate any suggestions on this.

Regards

sundar


Jerry Avins <jya@ieee.org> wrote in message news:<410673e9$0$5633$61fed72c@news.rcn.com>...
> Isn't the IFFT of a single non-zero "bin" something you can write by > inspection? Don't let details of the math isolate you from the reality > of what you're trying to do. > > You're twisting yourself around to the point that, while you may know > what you mean, you aren't communicating well. That shows very clearly > when you write, "Both A and B are complex outputs, and A is the real > while B is the imaginary ..." > > 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; > sundar wrote: > > > hi everyone, I know most of you by now must have gone mad with my > > posts and endless silly queries. Well the bad news is that i have some > > more. > > > > i read this in an report and am trying to follow this. > > > > I have a time domain signal, do a fft and get into freq domain. Then > > take the freq bin of interest and zero out the rest of the > > frequencies. Then i do my ifft for this filtered signal. lets say this > > output is A. Then if i rotate my filtered signal , by pi/2 and then do > > my ifft on it. we get say output B. Both A and B are complex outputs, > > and A is the real while B is the imaginary part and can be used to > > calculate the magnitude and phase. > > > > does this sound ok to you all. > > > > Waiting for some help. > > > > Regards > > > > Sundar > > > > > > > > > > > > Randy Yates <yates@ieee.org> wrote in message news:<y8l7iza7.fsf@ieee.org>... > > > >>Hi sundar, > >> > >>What is confusing me in your description is the nature of the three > >>"tonals" (I assume you mean sinusoids). Are they separated in > >>frequency by a known minimum? If so, then you can perform the > >>operations I think you desire by first bandpass-filtering the input to > >>isolate the one frequency of interest, then performing the Hilbert > >>transform on the result to get y[n] = A[n]e^(j*theta), where > >>theta = j*2*pi*f*n*T + phi). Computing (theta[n] - theta[n-1]) / T > >>of y[n] gives the instantaneous frequency, A[n] is the envelope. > >> > >>--RY > >> > >>snsundar@olemiss.edu (sundar) writes: > >> > >> > >>>hi Stephen, > >>> > >>>Iam sorry for the vagueness in my description, thats because honestly > >>>iam little lost in this place, and trying hard to stay afloat. > >>> > >>>Ok i am trying to find how my one particular frequency changes with > >>>time.Does that make sense....?.. > >>> > >>>also i was trying to get a envelope of my time domain signal. > >>> > >>>regards. > >>> > >>>sundar > >>> > >>> > >>>Stephan M. Bernsee <spam@dspdimension.com> wrote in message news:<2md87gFllv9hU1@uni-berlin.de>... > >>> > >>>>Hi Sundar, > >>>> > >>>>I have some more questions for you because I'm afraid your description > >>>>is still a bit vague: > >>>> > >>>>On 2004-07-23 21:31:55 +0200, snsundar@olemiss.edu (sundar) said: > >>>> > >>>> > >>>>>Iam now a little more clear as to where iam heading. ok so getting > >>>>>back to where i was . Iam trying to find the instantaneous frequency > >>>>>by using hilbert transforms. this is where i stand. > >>>> > >>>>The instantaneous frequency of what exactly are you trying to > >>>>determine? Your time domain sequence? Some frequency range of that > >>>>sequence? One particular frequency? > >>>> > >>>>And where is the connection to your time domain amplitude envelope?
He is describing an exact frequency component algorithm by using
Hilbert transform(HT). Unfortunately, he didn't describe it correctly.

In frequency estimation, the conventional way to do that is on two
steps:
1. using whatever spectrum method or simply a N-point FFT to show
frequency peaks, this is called coarse estimation. The peak regions
are then filtered out for step 2 use.

2. exact frequency estimation
This step takes a lot of computation since the resolution should be
very high or FFT length very high. But the task is simple: just do a
frequency sweeping at left and right points of the peak value. With
HT, the speed can be increase since only the magnitude and phase of
the original sequence are needed. I skip the equations here, you can
find reference easily on the Web or the original poster may point out
the paper he is referring to.

The reason why HT is used is because a causal sequence has been used,
that means the analytical sequence's(defined as the FFT without the
negative frequency part) real part and imaginary part are related by
HT, ie., the phase and magnitude of the sequence is easily know after
HT to the original sequence.