好文档 - 专业文书写作范文服务资料分享网站

一天征服傅里叶变换 - 图文

天下 分享 时间: 加入收藏 我要投稿 点赞

并不需要经典 FFT 的 2 的幂的限制下面清单 1.4 以程序 smbFft()给出了一个 FFT 的实现

Listing 1.4: The Discrete Fast Fourier Transform (FFT):

#define M_PI 3.14159265358979323846

void smbFft(float *fftBuffer, long fftFrameSize, long sign)

/*

FFT routine, (C)1996 S.M.Bernsee. Sign = -1 is FFT, 1 is iFFT (inverse)

Fills fftBuffer[0...2*fftFrameSize-1] with the Fourier transform of the time domain data in fftBuffer [0...2*fftFrameSize-1]. The FFT array takes and returns the cosine and sine parts in an interleaved manner, ie. fftBuffer[0] = cosPart[0], fftBuffer[1] = sinPart[0], asf. fftFrameSize must be a power of 2. It expects a complex input signal (see footnote 2), ie. when working with 'common' audio sig nals our input signal has to be passed as {in[0],0.,in[1],0.,in[2],0.,...} asf. In that case, the transform of the frequencies of interest is in fftBuffer[0...fftFrameSize].

*/

{

float wr, wi, arg, *p1, *p2, temp;

float tr, ti, ur, ui, ur, ui, *p1r, *p1i, *p2r, *p2i; long i, bitm, j, le, le2, k;

for (i = 2; i < 2*fftFrameSize-2; i += 2) {

for (bitm = 2, j = 0; bitm < 2*fftFrameSize; bitm <<= 1) { if (i & bitm) j++; j <<= 1; }

if (i < j) {

p1 = fftBuffer+i; p2 = fftBuffer+j;

}

temp = *p1; *(p1++) = *p2; *(p2++) = temp; temp = *p1; *p1 = *p2; *p2 = temp;

}

for (k = 0, le = 2; k < (long)(log(fftFrameSize)/log(2.)); k++) {

le <<= 1; le2 = le>>1; ur = 1.0; ui = 0.0;

arg = M_PI / (le2>>1);

wr = cos(arg); wi = sign*sin(arg);

for (j = 0; j < le2; j += 2) {

p1r = fftBuffer+j; p1i = p1r+1; p2r = p1r+le2; p2i = p2r+1;

for (i = j; i < 2*fftFrameSize; i += le) {

tr = *p2r * ur - *p2i * ui; ti = *p2r * ui + *p2i * ur; *p2r = *p1r - tr; *p2i = *p1i - ti;

*p1r += tr; *p1i += ti; p1r += le; p1i += le; p2r += le; p2i += le; }

tr = ur*wr - ui*wi;

ui = ur*wi + ui*wr; ur = tr;

}

}

}

The DFT “à Pied”: Mastering The Fourier Transform in One Day Posted by Bernsee on September 21, 1999 · 50 Comments

If you’re into signal processing, you will no doubt say that the headline is a very tall claim. I would second this. Of course you can’t learn all the bells and whistles of the Fourier transform in one day without practising and repeating and eventually delving into the maths. However, this online course will provide you with the basic knowledge of how the Fourier transform works, why it works and why it can be very simple to comprehend when we’re using a somewhat unconventional approach. The important part: you will learn the basics of the Fourier transform completely without any maths that goes beyond adding and multiplying numbers! I will try to explain the Fourier transform in its practical application to audio signal processing in no more than six paragraphs below.

Step 1: Some simple prerequisites

What you need to understand the following paragraphs are essentially four things: how to add numbers, how to multiply and divide them and what a sine, a cosine and a sinusoid is and how they look. Obviously, I will skip the first two things and just explain a bit the last one. You probably remember from your days at school the ‘trigonometric functions’* that were somehow mysteriously used in conjunction with triangles to calculate the length of its sides from its inner angles and vice versa. We don’t need all these things here, we just need to know how the two most important trigonometric functions, the ?sine? and ?cosine? look like. This is quite simple: they look like very simple waves with peaks and valleys in them that stretch out to infinity to the left and the right of the observer.

As you can see, both waves are periodic, which means that after a certain time, the period, they look the same again. Also, both waves look alike, but the cosine wave appears to start at its maximum, while the sine wave starts at zero. Now in practice, how can we tell whether a wave we observe at a given time started out at its maximum, or at zero? Good question: we can’t. There’s no way to discern a sine wave and a cosine wave in practice, thus we call any wave that looks like a sine or cosine wave a ?sinusoid?, which is Greek and translates to ?sinus-like?. An important property of sinusoids is ?frequency?, which tells us how many peaks and valleys we can count in a given period of time. High frequency means many peaks and valleys, low frequency means few peaks and valleys:

Step 2: Understanding the Fourier Theorem

Jean-Baptiste Joseph Fourier was one of those children parents are either proud or ashamed of, as he started throwing highly complicated mathematical terms at them at the age of fourteen. Although he did a lot of important work during his lifetime, the probably most significant thing he discovered had to do with the conduction of heat in materials. He came up with an equation that described how the heat would travel in a certain medium, and solved this equation with an infinite series of trigonometric functions (the sines and cosines we have discussed above). Basically, and related to our topic, what Fourier discovered boils down to the general rule that every signal, however complex, can be represented by a sum of sinusoid functions that are individually mixed.

一天征服傅里叶变换 - 图文

并不需要经典FFT的2的幂的限制下面清单1.4以程序smbFft()给出了一个FFT的实现Listing1.4:TheDiscreteFastFourierTransform(FFT):#defineM_PI3.14159265358979323846
推荐度:
点击下载文档文档为doc格式
80pso6x7fg34ka294oz8
领取福利

微信扫码领取福利

微信扫码分享