Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

fast fourier transform 1

Status
Not open for further replies.

JerryLin

Automotive
Feb 18, 2004
3
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!

 
Replies continue below

Recommended for you

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)

 
Thank you for your advice!
I am a little bit confused about your method.
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!
 
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?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor