⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hc234.m

📁 某本matlab书籍中的代码
💻 M
字号:
%《数字信号处理教程——MATLAB释义与实现》第二章例2.3.4程序hc234
% 信号序列的折叠、移位与卷积
% 电子工业出版社出版  陈怀琛编著 2004年9月
%
x = [3,-3,7,0,-1,5,2]; nx = [-4:2];
% 脉冲响应 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');   % 画出 x(k) 
axis([-5,5,-6,12]);
set(gcf,'color','w')                        % 置图形背景色为白
hold on; stem(nh+0.05,h,':')                % 画出 h(k)
title('x(k) 和 h(k)');a=axis;text(a(2)+.5,a(3),'k');
text(-1.5,11,'实线: x  虚线: h'); hold off
line([-5,5],[0,0])
    subplot(2,2,2); stem(nx-0.05,x,'filled');   % 画出 x(k) 
axis([-5,5,-6,12]);
hold on; stem(-fliplr(nh)+0.05,fliplr(h),':')       % 把h(k)折叠,画出 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,'实线: x  虚线: h'); hold off
line([-5,5],[0,0])
    subplot(2,2,3); stem(nx-0.05,x,'filled');   % 画出 x(k)  
axis([-5,5,-6,12]);  
hold on; stem(-fliplr(nh)+0.05-1,fliplr(h),':')    % 把h(k+1)折叠,画出 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,'实线: x  虚线: h'); hold off
line([-5,5],[0,0])
    subplot(2,2,4); stem(nx-0.05,x,'filled'); % 画出 x(k) 
axis([-5,5,-6,12]);
hold on; stem(-fliplr(nh)+0.05+2,fliplr(h),':')    % 把h(k-2)折叠,画出 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,'实线: x  虚线: h'); hold off
line([-5,5],[0,0])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -