Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

HELP required for FFT for health

HELP required for FFT for health

HELP required for FFT for health

Hi Guys ! I m new in this forum looking for somehelp. I want to make a monitoring system based on FFT for Ganerators and gearbox. I know that we will start off with Vibratoin sensor or accelerometer and samples from that. I know the DFT and FFT theratically.

I have looked up a couple f routines for FFT and using it due to Speed but all routines seems to work with INPUT as a complex time Array. My questions and I dont seem to find any answer or I may be knowing it already is " how I m going to convert the float valued samples from sensor in to a complex time series with unknown wave from and shape. "

CAN any one pleas send me any suggestoins. It will be greatly appreciated.


RE: HELP required for FFT for health

Why can't you just add 0*i to each sample.  Real data is ALL real.


RE: HELP required for FFT for health

IRstuff is correct.  The input to a FFT is magnitude and phase.  Often the phase is not known or is ignored.  This is the same as setting all phase values to zero.  Internally, the FFT works with complex numbers but this is usually done by converting the magnitude/phase  to real/imaginary.  If all phase input is zero the data is identical.

RE: HELP required for FFT for health

There is a simple way to do this , It is not elegant or fast but will do the job

The assumption in the snippet below is that you want to calculate the magnitude and phase of all frequency components , say from 0th to 40th harmonic in a set of data sampled in real time .
N is the number of samples of fundamental or first harmonic you expect to have in a cycle of data.
You can look at this as doing a fourier on a window of N samples and moving by a sample or a cycle after the whole of the code given below has executed.
There is a negative sign in front of the imaginary component as classical fourier is of the form e^-jt
for (x=0;x<40;x+=0.5)
Real =0
Imag =0
for (k=0;k<N;k++)
Real = Real + sample(k) * cos (2*PI*x*k/N)
Imag = Imag - sample(k) * sin(2*PI*x*k/N)
Mag = sqrt(Real *Real + Imag*Imag)
Phase = atan(Imag/Real);


Hope it helps

RE: HELP required for FFT for health


There are so many "off-the-shelf" solutions for this (machinery vibration monitoring using the FFT) already, and many of them reasonably priced.  Why reinvent the wheel and try to create something yourself?

Skip Hartman


RE: HELP required for FFT for health

Hello again,
There may be another solution...
Suppose you have a sequence of numbers x(n), with N numbers (N is power of 2).
Let the index n to be: n = 0..N-1
Now, suppose for a moment that you split your sequence into two sequences, x1(n)=x(2n) are the even numbers of your sequence, and x2(n)=x(2n+1), are the odd numbers.
Now you create a new complex sequence from these two sequences, y(n)=x1(n)+j*x2(n). Note that y(n) is half of the size of x(n).
After applying an FFT on this complex sequence, you get the following complex sequence:
where k is from 0 to N/2-1

Now that you have Y(k), the next step will be to compute conj(Y(N/2-K)). This is simply done by flipping from left to right the second element to the lat element. i.e.
[1 2 3 4] --> [1 4 3 2]. Note that the first element remains.
apply the conjugate on it, and you have the conj(Y(N/2-K)) sequence.
The next step is to compose Y1(k) and Y2(k)
Y1(k) = 0.5*[Y + conj(Y(N/2-k))]
Y2(k) = -j*0.5*[Y - conj(Y(N/2-k))]

Now, you can compose the sequence X(k)=dft(x(n)) (the one that you wanted from the start) from Y1(k) and Y2(k) as follow:
X(k)   = Y1(k) + (-1)^k * Y2(k), k=0..N/2-1
X(k+N) = Y1(k) - (-1)^k * Y2(k), k=0..N/2-1

This procedure may seem a little cumbersome, but this method reduces the size of the FFT on your sequence x(n) by half, that is FFT of N/2 points.

RE: HELP required for FFT for health

You can use your real input and create your complex number using std::complex.  You FFT library should have custom versions for real input.  In your application you would also probably want amplitude only output.  This is another customization you library should support.  If you have not chosen one, please check out http://www.fftw.org/.  What is your FFT size?  You might be able to do a straightforward DFT using std::valarray.
John Solar

RE: HELP required for FFT for health

The initial posted question brings up a more general issue, how to peform an DFT/FFT on sampled data.  

By its nature, sampled data is normally considered "REAL" in that it lacks in an imaginary component.  I am assuming here that one does not utilize quadrature sampling techniques, which could be another possible solution to the question of how to aquire Real and Imaginary sampled data.  It would seem that generally speaking it would not be practical to pass the data through a lengthy algorithm to generate an imaginary component due to processing time constraints, especially if one is working in real time.

I thought from my previous readings on the FFT that its response to a real input (real sinusoid) was to mirror itself about Fsample/2, where the FFT response to a complex input does not have this mirroring.

Perhaps someone with more experience with the FFT could elaborate.

RE: HELP required for FFT for health

Noway2, you are correct.  A real signal is lets say cos(wt).  An analytic form of a positive frequency only is exp(jwt).  From an Euler identity we have
exp(jwt) = (cos(wt)+j*sin(wt)).
  So a real signal has both positive and negative frequency, as seen from the inverse identity
cos(wt) = (exp(jwt) + exp(-jwt))/2;  
Half the signal is at a positive frequency and the other half at the negative frequency.  Negative frequencies are a little bit disconcerting.  They are just a mathematical artifice.  Don't ask your local RF or audio engineer to give you negative frequencies out from their generators!

The negative frequency components have nothing to do with the Fourier transform (FT).  They exist because of the relationship of the time to the frequency domain. The transform just allows us to convert back and forth.

There is nothing you need to do to input a real signal into a FT.  The imaginary component of a real number is just zero, as noted and posted at first by IRstuff back in January.

There are algorithms to convert a real signal into its analytic form.  It is called a Hilbert transform (HT).  The HT gives a 90 degree shift for all frequencies (that includes DC, which can not be done, so we only approximate an HT at low frequencies).  In this case you would not create an analytic form for input into the FT.  The correct method is as Irstuff suggested, or to use a Fast FT (FFT) specialized for real data inputs only.

Best Regards,
John Solar

RE: HELP required for FFT for health

You have a point about negative frequencies being a little bit disconcerting.  I remember when I first read about them.  The concept kind of falls into the same category as "complex  
" and "imaginary" numbers which are probably poor word choices.  I have been studying DSP for about three years now and I feel that I am just now beginning to gain an intuitive understanding of some of these concepts.  I find that it helps to often times try to keep Euler's identity and Taylor Series in mind for understanding this kind of material.

Anyway, this discussion reminded me of a piece of graffiti I saw written in the mens room at a restaurant that I think many of you can appreciate.  Somebody wrote "e^i*pi + 1 = 0" on the wall.  I must admit that I really laughed when I saw that, especially in comparison to the normal elegant prose written in places like that.

RE: HELP required for FFT for health

Negative frequencies-I don't know why signal processing books fail to explain this.

If you move a point around a circle and look at it edge wise. the points' amplitude is a sine wave.  By convention, when the point moves in a counterclockwise direction the frequency is positive.  If the point moves in a clockwise direction, the frequency is negative.  The point still traces out a sine wave.

Imaginary numbers should have been (should be?) called orthogonal numbers.

RE: HELP required for FFT for health

There is a NASA patent about using cepstrum ( == spectrum of spectrum) to monitor ball bearing for incipient defects.

<nbucska@pcperipherals DOT com> subj: eng-tips
read FAQ240-1032

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close