第四章快速傅里叶变换 补充内容 与本章内容有关的 MATLAB知识 l、ft -Discrete Fourier transform tax Y=fit(X) Y=fit(X, n) Y=fit(X. .dim) Y=fit(X n, dim) Definition The functions X= fit(x)and x=ifit(X) implement the transform and inverse transform pair given for vectors of length by (-1)(k-1) where -(2mi) is an Nth root of unity Description Y=fit(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, fit operates on the first nonsingleton dimension
第四章 快速傅里叶变换 补充内容: 与本章内容有关的 MATLAB 知识 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: 1 1 1 j k N N j X k x j 1 1 1 1 N j k N k x j X k N where 2 i N N e is an Nth 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=fit(X, n) returns the t 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=fit(x, [l, dim)and Y=fit(X, n, dim) applies the FFT operation across the dimension dim Examples A common use of Fourier transforms is to find the frequency components of a signal buried 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; x= sin(2 pi*50*t)+sin(2 pi* 120*t) y=x+2° randn(size(t) plo(1000*(1:50)y(1:50) title('Signal Corrupted with Zero-Mean Random Noise) xlabel(time(milliseconds),) Signal Corrupted with Zero-Mean Random Noise time(milliseconds) 2、dct -Discrete cosine transform (dCT) Syntax y=dct(x)
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 operation across the dimension dim. 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; x = sin(2*pi*50*t)+sin(2*pi*120*t); y = x + 2*randn(size(t)); plot(1000*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)') 0 5 10 15 20 25 30 35 40 45 50 -5 -4 -3 -2 -1 0 1 2 3 4 5 Signal Corrupted with Zero-Mean Random Noise time (milliseconds) 2、dct ——Discrete cosine transform (DCT) Syntax y = dct(x)
Descripti y=dct(x)returns the unitary discrete cosine transform of y(k)=(k)∑x(n) (2n-1)(k-1) where k=1 N v(k)= V,2≤k≤N n is the length of x, and x and y are the same size. If x is a matrix, dct transforms its columns. The series is indexed from n =1 and k= l instead of the usual n =0 and k=o because matlab vectors run from 1 to n instead of from o to n-1 y= dct(x, n) pads or truncates x to length n before transforming The dct is closely related to the discrete Fourier transform. You can often reconstruct a sequence very accurately from only a few dCt coefficients, a useful property for applications requiring data reduction Examples Find how many DCt coefficients represent 99% of the energy in a sequence: x=(1: 100)+ 50°cos(1:100*2°pi/40) XX, ind] =sort(abs(X); ind = fliplr(ind); i=1 while(norm([X(ind(1: i)) zeros(1, 100-1)))norm(X)<.99) 1;
y = dct(x,n) Description y = dct(x) returns the unitary discrete cosine transform of x 1 2 1 1 cos , 1, , 2 N n n k y k w k x n k N N where 1 , 1 2 , 2 k N w k k N N N is the length of x, and x and y are the same size. If x is a matrix, dct transforms its columns. The series is indexed from n = 1 and k = 1 instead of the usual n = 0 and k = 0 because MATLAB vectors run from 1 to N instead of from 0 to N- 1. y = dct(x,n) pads or truncates x to length n before transforming. The DCT is closely related to the discrete Fourier transform. You can often reconstruct a sequence very accurately from only a few DCT coefficients, a useful property for applications requiring data reduction. Examples Find how many DCT coefficients represent 99% of the energy in a sequence: x = (1:100) + 50*cos((1:100)*2*pi/40); X = dct(x); [XX,ind] = sort(abs(X)); ind = fliplr(ind); i = 1; while (norm([X(ind(1:i)) zeros(1,100-i)])/norm(X)<.99) i = i + 1; end i = 3