?? shiyan2.m
字號(hào):
%實(shí)驗(yàn)二:卷積定理
%陳友興
x=[3 0 2 1 3]; %原始序列
y=[3 0 2 1 3];
%直接計(jì)算圓周卷積或線性卷積
z=conv(x,y);
figure(1),subplot(311),stem(x);axis([1 8 0 4]);
subplot(312),stem(y);axis([1 8 0 4]);
subplot(313),stem(z);axis([1 8 0 30]);
%利用FFT計(jì)算
N=10;%N=8時(shí)
x1=[x zeros(1,N-length(x))];
y1=[y zeros(1,N-length(y))];
X1=fft(x1);
Y1=fft(y1);
Z1=X1.*Y1;
z1=ifft(Z1);
figure(2),
subplot(321),stem(x1);
subplot(322),stem(real(X1));
subplot(323),stem(y1);
subplot(324),stem(real(X1));
subplot(325),stem(z1);
subplot(326),stem(real(Z1));
N=5;%N=5時(shí)
x2=[x zeros(1,N-length(x))];
y2=[y zeros(1,N-length(y))];
X2=fft(x2);
Y2=fft(y2);
Z2=X2.*Y2;
z2=ifft(Z2);
figure(3),
subplot(321),stem(x2);
subplot(322),stem(real(X2));
subplot(323),stem(y2);
subplot(324),stem(real(X2));
subplot(325),stem(z2);
subplot(326),stem(real(Z2));
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -