?? hc234.m
字號(hào):
%《數(shù)字信號(hào)處理教程——MATLAB釋義與實(shí)現(xiàn)》第二章例2.3.4程序hc234
% 信號(hào)序列的折疊、移位與卷積
% 電子工業(yè)出版社出版 陳懷琛編著 2004年9月
%
x = [3,-3,7,0,-1,5,2]; nx = [-4:2];
% 脈沖響應(yīng) h(n)
h = [2,3,0,-5,2,1]; nh = [-1:4];
subplot(1,1,1)
subplot(2,2,1); stem(nx-0.05,x,'filled'); % 畫(huà)出 x(k)
axis([-5,5,-6,12]);
set(gcf,'color','w') % 置圖形背景色為白
hold on; stem(nh+0.05,h,':') % 畫(huà)出 h(k)
title('x(k) 和 h(k)');a=axis;text(a(2)+.5,a(3),'k');
text(-1.5,11,'實(shí)線: x 虛線: h'); hold off
line([-5,5],[0,0])
subplot(2,2,2); stem(nx-0.05,x,'filled'); % 畫(huà)出 x(k)
axis([-5,5,-6,12]);
hold on; stem(-fliplr(nh)+0.05,fliplr(h),':') % 把h(k)折疊,畫(huà)出 h(-k)
title('x(k) 和 h(-k)');a=axis;text(a(2)+.5,a(3),'k')
text(-0.5,-1,'n=0')
text(-1.5,11,'實(shí)線: x 虛線: h'); hold off
line([-5,5],[0,0])
subplot(2,2,3); stem(nx-0.05,x,'filled'); % 畫(huà)出 x(k)
axis([-5,5,-6,12]);
hold on; stem(-fliplr(nh)+0.05-1,fliplr(h),':') % 把h(k+1)折疊,畫(huà)出 h(-1-k)
title('x(k) 和 h(-1-k)');a=axis;text(a(2)+.5,a(3),'k');
text(-1.5,-1,'n=-1')
text(-1.5,11,'實(shí)線: x 虛線: h'); hold off
line([-5,5],[0,0])
subplot(2,2,4); stem(nx-0.05,x,'filled'); % 畫(huà)出 x(k)
axis([-5,5,-6,12]);
hold on; stem(-fliplr(nh)+0.05+2,fliplr(h),':') % 把h(k-2)折疊,畫(huà)出 h(2-k)
title('x(k) 和 h(2-k)');a=axis;text(a(2)+.5,a(3),'k');
text(2-0.5,-1,'n=2')
text(-1.5,11,'實(shí)線: x 虛線: h'); hold off
line([-5,5],[0,0])
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -