×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# fast fourier transform

## fast fourier transform

(OP)
I am now doing data processing of the frequency response tests such that a continuous sinusoidal steering wheel input with 0.3 - 2.5 Hz was applied. Then I want to use fft to derive data in frequency domain. For example, I want to know the value of yaw rate at certain phase lag. How to do this?

Thanks!

### RE: fast fourier transform

Taking the FFT of a signal will decompose it into each contributing frequency, giving you the amplitude and phase.

If you are trying to measure the yaw lag to a given steering input, you don't need a full FFT.  You just have to:
- Normalize your data (scale it to +/- 1)
- Multiply your data by a sine function of the frequency you want to examine (steering input frequency) and add up all the numbers.  Lets call this A
- Multiply your data by a cosine function of the same frequency and add them all up. Call this B
- Divide each A and B by the number of samples used.
- The magnitude (yaw distance) will be A**2+B**2
- The phase (yaw lag) will be arctan(A/B)

### RE: fast fourier transform

(OP)
First, why it need to be normalized?
Second, what do you mean a sine function of the frequency? for example, I want to examine 1Hz, so the function is sin(2*pi*1*t)????

Thanks again!

### RE: fast fourier transform

Actually, it doesn't need to be normalized.   I always do (for what I work on), so thats why I put it in.

Lets say you are sampling at 10khz, and you want to examine your vehicle with a steering input of 2.0 Hz.   You can do less, but I would make sure your sinusoid has at least 3 cycles, so your window (data you are working with at one time) should be 1.5 seconds, or 15,000 samples.   Generate a sine and cosine wave that would resemble a 2.0 Hz wave in phase with your steering input.

FREQ=2
SAMP_RATE=10000
for x=1 to 15,000
Swave(x)=Sin( (2*PI*FREQ*x)/SAMP_RATE )
Cwave(x)=Cos( (2*PI*FREQ*x)/SAMP_RATE )
end

For each sample in your 1.5 second window, multiply your signal by the corresponding sine and add it to a variable.   Do the same for the cosine wave, summing to yet another variable.

A=0
B=0
for x=1 to 15,000
A=A+(Swave(x)*Signal(x))
B=B+(Cwave(x)*Signal(x))
end

Divide each of these variables separately by the total number of samples in your window.  This makes sure your amplitude will have the same range as your data does.

A=A/15,000
B=B/15,000

Now use trig to find the amplitude (amount of yaw) and the phase (lag)

Amplitude=2*sqrt(A**2+B**2)
Phase=invtan(A/B)

If you are using matlab, the phase would be atan2(BB,AA), by the way.   You may want to try looking online for the Goertzel Algorithm, as well as FFT.   The method I explained here is not the fastest, but by far the easiest to implement.

Is this better?

### RE: fast fourier transform

(OP)
Thank you very much!
It works

#### 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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!