1

$f(t) = at+b$ for $t\in[0,1)$

then the Fourier transform on that interval is:

$\hat{f}(\nu) = \int_0^1f(t)e^{-2\pi\nu ti}dt=$

$$\int_0^1 (at+b)\exp(-i(2\pi vt))\,\mathrm dt=\frac {e^{-2i\pi v}\left(-e^{2i\pi v}(a+2i\pi bv)+2i\pi av+a+2i\pi bv\right)} {4\pi^2v^2}$$

(calculated using WolframAlpha)

The following R script uses the Fourier transormation $\hat{f}$ = F to compose $f$ (supposed to be equal to f2) from a set of frequencies:

# .01 RPM to 20 RPM in .01 intervals
freq <- 1:2000/100
# plot region
x <- -100:200/100

f <- function(t,a,b) a*t + b #here a=1, b=1
I <- complex(imaginary = 1)

F <- function(v,a,b) exp(-2*I*pi*v) * (
        -exp(2*I*pi*v) * 
        (a + 2*I*pi*b*v) + 2*I*pi*a*v + 2*I*pi*b*v + a
    ) / (4*pi^2*v^2)

f2 <- function(t) sum(Mod(F(freq,1,1)) * cos(t*freq*2*pi + Arg(F(freq,1,1))))

plot(x,sapply(x,f2), pch=19, col=rgb(1,0,0,alpha=.2), cex=1)

enter image description here

That looks very nice but apparently I would have to mutliply the retransformation with 1/50 to get the scaling right.

Questions:

  1. How do I know how to scale a Fourier retransformation without having to check the result?
  2. What is the technical foundation of this scaling?

code with suggested corrections: https://github.com/joyofdata/miscellaneous/blob/master/fourier-transform.r

Raffael
  • 145
  • You are aware that the discretization of the inverse Fourier transform reads as $\sum_{\nu\in \textrm{freq}\cup -\textrm{freq}}\hat f(\nu)e^{i2\pi\nu t}\Delta\nu$, where I want to hint at the $\Delta\nu$ factor containing the step size of the frequency – Lutz Lehmann Jan 10 '14 at 13:11
  • to be honest, I am not aware of that - this little experiment serves the purpose of helping to wrap my head around FT. having said that, I would appreciate a simple and full answer to my question :) – Raffael Jan 10 '14 at 13:22

2 Answers2

1

There are three major transform pairs used in the Fourier transform that distribute their multiplicative constants differently. The transform pair in your scaling is often preferred in signal processing, for the forward transform

$$\hat f(\nu)=\int_{I\!R}f(t)\exp(-2\pi i\,\nu t)\,dt$$

and similarly the backward transform

$$f(t)=\int_{I\!R}\hat f(\nu)\exp(2\pi i\,\nu t)\,d\nu$$

Since $f$ is real, $\hat f(-\nu)=\overline{\hat f(\nu)}$

For a function $f$ with jumps, the asymtotic behavior of the transform is $\hat f(\nu)\sim\frac1\nu$ for large values of $|\nu|$. Therefore it is reasonable to use such a large frequency range $[-20,20]$ in the discretization. You are using a step size of $Δν=1/100$ with $N=2000$ steps, so that the discretized integral is

$$\sum_{k=-N}^{N}\hat f(kΔν)\exp(2\pi i\, (kΔν)t)\,Δν=\hat f(0)Δν+2Δν\sum_{k=1}^{N}\text{Re}\Bigl(\hat f(kΔν)\exp(2\pi i\, (kΔν)t)\Bigr)$$

or in your formulation with $\hat f(kΔν)=m_k\exp(i\, \phi_k)$ (modulus and phase),

$$\text{Re}\Bigl(\hat f(kΔν)\exp(2\pi i\, (kΔν)t)\Bigr)=m_k\cos\Bigl(2\pi (kΔν)t+\phi_k\Bigr).$$

Since $Δν$ is small, it does not matter much if some of the terms such as $\hat f(0)Δν$ are missing. The factor $2Δν$ before the sum is exactly the missing $1/50$.

Lutz Lehmann
  • 126,666
1

It is often useful to note that if $g(x)=f(ax)$ then $$ \begin{align} \hat{g}(\xi) &=\int_{-\infty}^\infty g(x)\,e^{-2\pi ix\xi}\,\mathrm{d}x\\ &=\int_{-\infty}^\infty f(ax)\,e^{-2\pi ix\xi}\,\mathrm{d}x\\ &=\frac1a\int_{-\infty}^\infty f(x)\,e^{-2\pi ix\xi/a}\,\mathrm{d}x\\ &=\frac1a\hat{f}\left(\frac{\xi}{a}\right) \end{align} $$

robjohn
  • 345,667