Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Frequency domain integration and differentiation

Status
Not open for further replies.

rih5342

Marine/Ocean
May 8, 2007
40
I have a question about phase shifts when integrating or
differentiating in the frequency domain.

To verify my calculations, I generate test cases in the time domain and compare with my frequency domain calculations.

I take velocity data (a single frequency sine wave) and
calculate accelerations and displacements by
differentiating or integrating in the frequency domain
by using the following:

d( s(t) )/dt = (i 2 pi fn)*S(fn)
int( s(t) ) dt = S(fn)/(i 2 pi fn)

For example, to find displacments, I fast-fourier-transform (FFT)velocity-time-domain data, then integrate in the frequency domain by looping through the FFT coefficients, dividing by the array index, then inverse-FFT back to the time domain and compare with the analytic displacement data.

Because of the "negative frequencies" coming from the FFT,
I'm careful to not multiply or divide by a frequency corresponding to a "wave-number" greater than 128 (for this case with 256 samples).

The resulting time-domain displacemsnts and accelerations are accurate but have a phase shift of about 6 delta-ts out of 256

Since my data is perfectly periodic, I can do a circular shift to get an exact result.

Here's my question: Where does the time shift come from?

Is it numerical in origin, have I made a mistake,
is it my FFT routine (literally a typed in textbook example), or have I left out some detail?

RIH5342
 
Replies continue below

Recommended for you

For example, to find displacments, I fast-fourier-transform (FFT)velocity-time-domain data, then integrate in the frequency domain by looping through the FFT coefficients, dividing by the array index,
An array index is a real number. You should be dividing by an imaginary number (remember the i in your denominator?). Neglecting this will surely cause an error in your phase.

There will also be some attention required to magnitude of the scale factors to get the proper magnitude... the scale factors involve unit conversions (if you're not using SI) and sample frequency. But these kinds of scaling errors don't affect phase.



=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
differentiation and integration result in +/- 90 deg phase shifts you've noted, these do give tise to time shifts

 
Yes, acceleration leads velocity by 90 degrees and displacement lags velocity by 90 degrees. If that was what was observed, it would of course be correct.

I don't believe the OP was saing he saw a 90 degree phase shift from input to output of his operation.

I think the OP is saying he saw a phase "shift" (error) compared to the expected phase of the output. And indeed that would be the case from implementing the operation described by the OP. If you take the complex velocity FFT coefficients and attempt to perform differentiation by multiplying them by scalar array index k, then perform iFFT, you will get back something in-phase with velocity, not in-phase with acceleration. Hence the phase error.

Maybe OP can clarify which is the case.

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
You need to multiply the negative frequencies by i*omega too - not just ignore them.

M

--
Dr Michael F Platten
 
WOW, 4 replies!

Electricpete: i = imaginary number, but I am using a
non-complex-number array index. I'll have to check
the algebra, good point. So this means a negative sign
somewhere. The amplitudes are accurate, 5-6 digits, so
I've got that part right.

Hacksaw: my test case compares an analytic answer with my estimate. I am concerned with a phase shift error (I think!).

Electricpete: very interesting, (getting back something in-phase with velocity), I'll check it out.

MikeyP: negative frequencies are also being multiplied by I-omega. I'll recheck where the frequency origin is.

Thank you all.
 

I found my problem by comparing the FFTs of time-domain
integration and differentiation with my frequency domain approximations.

The required sign change of the coefficients is different
for negative frequencies compared to positive frequencies.

Everyone, thanks for your help.

Rob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor