实验一离散傅里叶变换的性质及应用.docx
《实验一离散傅里叶变换的性质及应用.docx》由会员分享,可在线阅读,更多相关《实验一离散傅里叶变换的性质及应用.docx(7页珍藏版)》请在冰豆网上搜索。
实验一离散傅里叶变换的性质及应用
实验一 离散傅里叶变换的性质及应用
一、实验目的
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;
clearall;
closeall;
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('xsequence')
ylabel('x(n)')
subplot(2,3,2)
le2=0:
1:
sizeh-1;
stem(le2,h);
title('hsequence')
ylabel('h(n)')
subplot(2,3,3)
le3=0:
1:
sizex+sizeh-2;
stem(le3,y,'g')
title('ysequencebydirectmetod')
ylabel('y(n)')
LL=[6912];
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 byFFT L=6')
elseif(n==2)
title('ysequemcebyFFT L=9')
elseif(n==3)
title('ysequencebyFFTL=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=
Columns1through22
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Columns23through44
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
Columns45through66
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
Columns67through88
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
Columns89through110
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
Columns111through132
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
Columns133through154
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
Columns155through176
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
Columns177through198
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
Columns199through220
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
Columns221through242
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
Columns243through256
242 243 244 245 246 247 248 249 250 251 252 253 254 255
t1=
0.7644
t2=
0.6396
t3=
0
x=
1 2 3 4
Y=
-10.0000 -9.5000+11.2583i 3.5000-6.0622i -2.0000 3.5000+6.0622i -9.5000-11.2583i
Y=
Columns1through7
-10.0000 -7.4363-21.7778i 4.5753-1.6805i 3.5000-6.0622i 4.3610+1.9108i 4.3610-1.9108i 3.5000+6.0622i
Columns8through9
4.5753+1.6805i -7.4363+21.7778i
Y=
Columns1through7
-10.0000 14.7942-17.6244i -9.5000+11.2583i -2.0000-2.0000i 3.5000-6.0622i -0.7942+6.6244i -2.0000
Columns8through12
-0.7942-6.6244i 3.5000+6.0622i -2.0000+2.0000i -9.5000-11.2583i 14.7942+17.6244i
r=
4.4000
f1=
34.3750
f2=
0
f3=
34.3750