Chinaunix首页 | 论坛 | 博客
  • 博客访问: 295804
  • 博文数量: 71
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 734
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-20 17:17
文章分类

全部博文(71)

文章存档

2011年(1)

2009年(70)

我的朋友

分类:

2009-06-02 11:12:01

fft
Fast Fourier Transform 的缩写, 即为快速傅氏变换,是离散傅氏变换的快速算法,它是根据离散傅氏变换的奇、偶、虚、实等特性,对离散傅立叶变换的算法进行改进获得的。它对傅氏变换的理论并没有新的发现,但是对于在计算机系统或者说数字系统中应用离散傅立叶变换,可以说是进了一大步。
  即为快速傅氏变换,是离散傅氏变换的快速算法,它是根据离散傅氏变换的奇、偶、虚、实等特性,对离散傅立叶变换的算法进行改进获得的。它对傅氏变换的理论并没有新的发现,但是对于在计算机系统或者说数字系统中应用离散傅立叶变换,可以说是进了一大步。
  设x(n)为N项的复数序列,由DFT变换,任一X(m)的计算都需要N次复数乘法和N-1次复数加法,而一次复数乘法等于四次实数乘法和两次实数加法,一次复数加法等于两次实数加法,即使把一次复数乘法和一次复数加法定义成一次“运算”(四次实数乘法和四次实数加法),那么求出N项复数序列的X(m),即N点DFT变换大约就需要N^2次运算。当N=1024点甚至更多的时候,需要N2=1048576次运算,在FFT中,利用WN的周期性和对称性,把一个N项序列(设N=2k,k为正整数),分为两个N/2项的子序列,每个N/2点DFT变换需要(N/2)^2次运算,再用N次运算把两个N/2点的DFT变换组合成一个N点的DFT变换。这样变换以后,总的运算次数就变成N+2(N/2)^2=N+N^2/2。继续上面的例子,N=1024时,总的运算次数就变成了525312次,节省了大约50%的运算量。而如果我们将这种“一分为二”的思想不断进行下去,直到分成两两一组的DFT运算单元,那么N点的DFT变换就只需要Nlog(2)(N)次的运算,N在1024点时,运算量仅有10240次,是先前的直接算法的1%,点数越多,运算量的节约就越大,这就是FFT的优越性。
Discrete Fourier transform
Syntax
Y = fft(X)
Y = fft(X,n)
Y = fft(X,[],dim)
Y = fft(X,n,dim)
 
Definition

The functions X = fft(x) and x = ifft(X) implement the transform and inverse transform pair given for vectors of length  by: 
where 
is an th root of unity.
Description

Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed with a fast Fourier transform (FFT) algorithm.
If X is a matrix, fft returns the Fourier transform of each column of the matrix.
If X is a multidimensional array, fft operates on the first nonsingleton dimension.
Y = fft(X,n) returns the n-point DFT. If the length of X is less than n, X is padded with trailing zeros to length n. If the length of X is greater than n, the sequence X is truncated. When X is a matrix, the length of the columns are adjusted in the same manner.
Y = fft(X,[],dim) and Y = fft(X,n,dim) applies the FFT
 
Examples

A common use of Fourier transforms is to find the frequency components of a signal buried in a noisy time domain signal. Consider data sampled at 1000 Hz. Form a signal containing 50 Hz and 120 Hz and corrupt it with some zero-mean random noise:
t = 0:0.001:0.6; %取时间序列t,起始0,步长0.001,终止0.6
x = sin(2*pi*50*t)+sin(2*pi*120*t);%取信号x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t)); %randn(size(t))按照正态分布产生一个和矩阵t同型的伪随机的矩阵
subplot(2,1,1)%画出y的图像
plot(1000*t(1:50),y(1:50))%画出Y的图像
title('Signal Corrupted with Zero-Mean Random Noise')%给图像命名
xlabel('time (milliseconds)')%给图像横坐标加图注
Y = fft(y,512);%对y进行快速傅里叶变换
Pyy = Y.* conj(Y) / 512;%用Y乘以Y的共模
f = 1000*(0:256)/512;%获得频率向量
plot(f,Pyy(1:257))%画频谱图
title('Frequency content of y')%图的名称
xlabel('frequency (Hz)')%图横坐标的注释
 
阅读(1458) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~