#### Archived

This topic is now archived and is closed to further replies.

# Computing derivative with FFT

This topic is 5689 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was reading an article on gamasutra (a Game development community), which said that more accurate normals to a periodic heightfield can be computed using FFT. This is based on computing derivative with FFT, so I started coding this on a one-dimensional problem. I read these formulas: (1.) h(t) ==> H(f) // the Fourier transformation Now, to compute h''(t), we need to compute: (2.) G(f) = i*f*H(f) // derivative in fourier space (i is sqrt(-1) and f is the frequency) (3.) G(f) ==> h''(t) // back to time domain Do I have some fault in these formulas or why don''t they work? I use the following to compute (2.): for( i=0; i n goes from -N/2 to -N/2-1 // so here we do some linear transformations int n = i-N/2; float f = (float)n/(samplingRate*(float)N); dst[i] = dst[i] * Complex(0,f); } I learned FFT best (so far) from the book Numerical Recipes in C. Does anyone know a better book (I''ve tried DSPGuide)? Does anyone know how to implement this derivative thing in practice? - Mikko Kauppila

##### Share on other sites
I don''t think step 2 is correct. If you''re using frequency (Hz), and not angular frequency (radians/sec), it should be
G(f) = j*2*pi*f*H(f)

Besides that, is the function for calculating the fourier transform and inverse fourier transform correct?

1. 1
2. 2
3. 3
4. 4
frob
20
5. 5
JoeJ
20

• 11
• 11
• 12
• 13
• 9
• ### Forum Statistics

• Total Topics
632214
• Total Posts
3004853

×