[实验一离散傅里叶变换的性质及应用.doc
文本预览下载声明
实验一 离散傅里叶变换的性质及应用
一、实验目的
1.了解DFT的性质及其应用
2.熟悉MATLAB编程特点
二、实验仪器及材料
计算机,MATLAB软件
三、实验内容及要求
1.用三种不同的DFT程序计算的256点离散傅里叶变换,并比较三种程序计算机运行时间。
(1)编制用for loop语句的M函数文件dft1.m,用循环变量逐点计算;
(2)编写用MATLAB矩阵运算的M函数文件dft2.m,完成下列矩阵运算:
(3)调用fft库函数,直接计算;
(4)分别调用上述三种不同方式编写的DFT程序计算序列的离散傅里叶变换,并画出相应的幅频和相频特性,再比较各个程序的计算机运行时间。
2.研究实序列的DFT特点及性质。
已知序列,若计算下列三种情况下序列的DFT的幅度、实部及虚部,并用图形表示相应的。
(1),
(2),
(3),
3.利用DFT实现两序列的卷积运算,并研究DFT点数与混叠的关系。
(1)已知两序列
(2)用直接法(即用线性卷积的定义计算,见下式)计算线性卷积y(n)=x(n)*h(n)的结果,并以图形方式表示结果;
其中:序列和序列
(3)用MATLAB编制利用DFT计算线性卷积y(n)=x(n)*h(n)的程序;分别令圆周卷积的点数为L=5,6,7,8,以图形方式表示结果。
(4)对比直接法和圆周卷积法所得的结果。
clc;
clear all;
close all;
N=256;
x=[ones(1,8),zeros(1,N-8)];
n=[0: (length(x)-1)]
t=cputime;[Am1,Pha1]=dft1(x);t1=cputime-t,
t=cputime;[Am2,Pha2]=dft2(x);t2=cputime-t,
t=cputime;[Am3,Pha3]=dft3(x);t3=cputime-t,
sizex=4;
sizeh=6;
x=[1,2,3,4]
h=[0,1,0,0,0,-2];
y=conv(x,h);
figure(1)
subplot(2,3,1)
le1=0:1:sizex-1;
stem(le1,x,r);
title(x sequence)
ylabel(x(n))
subplot(2,3,2)
le2=0:1:sizeh-1;
stem(le2,h);
title(h sequence)
ylabel(h(n))
subplot(2,3,3)
le3=0:1:sizex+sizeh-2;
stem(le3,y,g)
title(y sequence by direct metod)
ylabel(y(n))
LL=[6 9 12];
for n=1:3
L=LL(n);X=fft(x,L);
H=fft(h,L);
Y=X.*H
yFFT=ifft(Y,L);
subplot(2,3,n+3)
le3=0:1:L-1;
stem(le3,yFFT);
if (n==1)
title(y sequence by FFT L=6)
elseif (n==2)
title(y sequemce by FFT L=9)
elseif (n==3)
title(y sequence by FFT L=12)
end
end
r=4.4
N=128;
n=0:N-1;x=5*cos(2*pi*r*n/N);
f1=1000*r/N,f2=1000*0/N,f3=1000*4.4/N
X=fft(x,N);
figure(2)
subplot(221);stem(n,x);
subplot(222);stem(n,abs(X));
subplot(223);stem(n,real(X));
subplot(224);stem(n,imag(X));
n =
Columns 1 through 22
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Columns 23 through 44
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
Columns 45 through 66
44 45 46 47 48 49 50 51
显示全部