Frequency domain integration and differentiation
Frequency domain integration and differentiation
(OP)
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
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





RE: Frequency domain integration and differentiation
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.
RE: Frequency domain integration and differentiation
RE: Frequency domain integration and differentiation
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.
RE: Frequency domain integration and differentiation
M
--
Dr Michael F Platten
RE: Frequency domain integration and differentiation
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.
RE: Frequency domain integration and differentiation
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