I have an aperiodic signal of an s-shape in the time-domain that I would like to filter and calculate the derivative of using the FFT. The jump at the end of the s-shape has, of course, a strong influence on the obtained amplitude spectrum. I am trying to eliminate the influence of the jump without giving less weight to the beginning and the end of my measurement by applying a window function.

Hence, as a first shot in the dark, my idea was to "brute force" the signal to be periodic by mirroring the s-shape at the end of the measurement, yielding a "bell curve". This approach yielded significantly improved results in the filtered signal and achieved a good approximation for the derivative. I am quite glad that this approach works and it helped me make a lot of progress recently.

However, I am still puzzled about why this approach works in the first place. Shouldn't the mirroring operation on my input signal significantly influence the output? Is there a theoretical reason for this approach working that I have overlooked?

Thank you in advance for all your thoughts and explanations.

Edit: I included a simplified example of what I did to brute force the periodic signal. As can be observed, the orange curve (ideal measurement without measurement noise) has an s-shape and ends abruptly at a certain value. I mirrored the curve around its last value to force a periodic "bell curve".

enter image description here

  • 2
    $\begingroup$ Picture would help. Also: why do you want to use an FFT based differentiator instead of simple time domain one ? $\endgroup$
    – Hilmar
    Apr 30, 2021 at 11:26
  • $\begingroup$ @Hilmar I added an image of what I did to force a periodic signal. I mainly want to use the FFT based differentiator because I would like to filter and take the derivative of the signal (in more or less) the same operation within the frequency domain. Further, I hoped that it could help me better understand the method in itself. To be honest, this is more of a gimmick than a strict necessity. $\endgroup$
    – pbaer
    Apr 30, 2021 at 15:07

1 Answer 1


Cascading the initial signal with it’s reverse does two notable things which facilitates the OP’s further processing:

First and most significantly it minimizes the end discontinuities which are visible by creating the equivalent periodic waveform. The Fourier Transform result for the finite duration waveform is equivalent to the transform for the same waveform periodically extended for all time (the non-zero Fourier results specifically). This visualization is useful to more intuitively understand the effect of the discontinuities in an equivalent continuous-time sampled context: very high frequency components are needed to transition in a very short period of time; these high frequency components alias back to lower frequencies for a sampled system and we can see the result as “spectral leakage”).

Second, as a note of interest, it creates a linear phase response in frequency. This is similar but not identical to the cascade of any FIR filter with its reverse filter: the resulting coefficients after the convolution of the two will be symmetric and the frequency response will be linear phase with a magnitude response as the cascade of the two filters (thus having a “squared magnitude” response). Consider if t=0 were at the center of the resulting mirrored time domain signal: the resulting frequency domain signal as the Fourier Transform would be real (symmetric about the vertical axis at t=0 in the time domain, or f=0 in the frequency domain will always be real in the other domain). By then shifting it to a later time as a causal signal, instead of being real in frequency, the resulting response with the exact same magnitude has an additional linear phase added but is otherwise not changed (a linear phase in frequency is a fixed delay in time). An example of this that may be more intuitive is a similar example in the frequency domain and how the time domain would be real because of the symmetry: Consider $2\cos(\omega t)$ which is a real time domain signal and has two symmetric impulses in the frequency domain at $\pm \omega$, (and we see this with Euler’s formula with $2\cos(\omega t)= e^{j \omega t} + e^{-j \omega t}$). With just one of those frequency domain impulses at $+\omega$, the time domain waveform would be complex and given as $e^{j \omega t}$.

This second point is an outcome of the theorem that the Fourier Transform of a real valued sequence is conjugate symmetric (so equivalently the Fourier Transform of a conjugate symmetric sequence is real), and is just describing how the result becomes linear phase (real plus an additional time delay so then complex with linear phase). Most significantly the OP has reduced the aliasing effects from the otherwise very large discontinuity in time while the original time domain sequence is completely recoverable from the frequency domain, so less prone to distortion effects with any subsequent processing in frequency prior to transforming back to the time domain, and noted that this was done without modification to any of the original time domain samples (as would be done with windowing). This was feasible since the derivative of the original waveform was zero or close to zero at the edges, thus minimizing the discontinuity in the equivalent periodic waveform after adding the mirrored component.

  • 1
    $\begingroup$ I think also that, if the example that the OP posted is representative of what they're doing, that the 1st derivative is zero at that point, and possibly even that the higher-order derivatives match up. Things would be worse if the line wasn't s-shaped, but rather straight (making the 1st derivative sharply discontinuous). $\endgroup$
    – TimWescott
    Apr 30, 2021 at 19:10
  • 1
    $\begingroup$ Yes indeed; which I tried to cover as the first point- the resulting periodic waveform has minimum discontinuity after mirroring. $\endgroup$ Apr 30, 2021 at 19:21
  • 1
    $\begingroup$ @pbaer it does modify both but the amplitude will be a factor of 2 in power so will have the same general shape if not affected by aliasing. Since going from time to frequency is the same operation as going from frequency to time, some times it is more intuitive to consider what would happen in the opposite direction. Here it may be easier for you to visualize the FT of a cosine: it is two impulses in frequency symmetric about the origin, and real in time. If you removed the second impulse in frequency- the time domain waveform becomes complex as $.5e^{j\omega t}$. (Which is 3 dB lower). $\endgroup$ May 1, 2021 at 13:07
  • 1
    $\begingroup$ So here you started with something that is single sided in frequency (instead of in time like your case) and the result was complex in time. By making it symmetric in frequency it became real in time. (Phase = 0 for all time samples). $\endgroup$ May 1, 2021 at 13:14
  • 1
    $\begingroup$ ...but most significant is that you reduced aliasing effects while being able to return to the original time domain function over the original interval in time. Reducing aliasing effects reduces distortion from any subsequent processing in frequency before transforming back to the time domain. $\endgroup$ May 1, 2021 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.