1

I'm trying to solve a simple mass-dashpot-spring system $$m\ddot{u}(t) + c\dot{u}(t) + ku(t) = F(t)$$ by making use of the Fourier transform defined as $$\tilde{f}(s) = \int_{-\infty}^{\infty} f(t) \, \mathrm{e}^{-\mathrm{i} (2 \pi s) t} \mathrm{d}t$$ such that the ODE transforms into $$-(2 \pi s)^2 m \tilde{u}(s) + \mathrm{i} (2 \pi s) c \tilde{u}(s) + k \tilde{u}(s) = \tilde{F}(s)$$ to eventually solve $$\tilde{u}(s) = \frac{\tilde{F}(s)}{-(2 \pi s)^2 m + \mathrm{i} (2 \pi s) c + k}$$ Say I have the forcing $$F(t) = \left\lbrace\matrix{\cos(t) & 0 \leq t < \pi/2 \\ 0 & \text{otherwise}}\right. \quad \rightarrow \quad \tilde{F}(s) = \frac{\mathrm{e}^{-\mathrm{i} \pi^2 s} + \mathrm{i} (2 \pi s)}{1-(2\pi s)^2}$$ accept the initial conditions $$u(0)=0, \; \dot{u}|_{t=0} = 0$$ and have the parameters $$m=1.3, \; c=0.6, \; k=1.7$$ Now, I want to transform it back to the time domain using the discrete Fourier transform. I think the basic idea is to compute solutions $\tilde{u}$ for several values of $s$ like this. If I plot the vector containing the complex valued solutions this results in (red - real, green - imaginary)

Then when using Maple's InverseFourierTransform function on the resulting vector I obtain rubbish:

What am I doing wrong here?

demorge
  • 293
  • Why are you using a discrete Fourier transform? Is this meant to be an approximation? – joriki Feb 19 '13 at 11:27
  • Yes, I'm actually trying to solve a FEM system, so this is just a simplified problem to get started... I know this can be done perfectly by hand though. – demorge Feb 19 '13 at 11:43
  • 1
    Just a guess (as I do not know Maple), but perhaps there is some shifting of the data going on in Maple. Something tells me, though, that is not the entire story, but at least it is a start. – Ron Gordon Feb 19 '13 at 12:04
  • The plot does look like a decaying wave. Maybe it simply does not resolve in the graph (i.e., the number of points is too low?) –  Feb 21 '13 at 02:40
  • @rlgordonma: You are right, after swapping the left and right parts of the vector all is well. I suggest you turn your comment into an answer so I can accept it. – demorge Feb 21 '13 at 08:29
  • @demorge: done, and thanks. – Ron Gordon Feb 21 '13 at 08:35

1 Answers1

2

Many times in programs like Maple, the Fourier transform routines shift the data so that what you would expect to be the center frequency is actually at the beginning of the array. In this case, you need to shift the data by half a cycle in the array to recover your expected behavior.

Ron Gordon
  • 138,521