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

📄 fig345.m

📁 高西全2009年最新版<数字信号处理>源码程序
💻 M
字号:
%《数字信号处理--原理、实现及应用》第三章图3.4.6 程序:Fig346.m
% 西安电子科技大学出版社出版  高西全  丁玉美合著 2008年5月
L=41;N=5;M=10;
hn=ones(1,N);hn1=[hn zeros(1,L-N)];	%产生h(n),补零是为了绘图好看
n=0:L-1;
xn=cos(pi*n/10)+cos(2*pi*n/5);		%产生x(n)的L个样值clear all;close all;
yn=fftfilt(hn,xn,10);
n=0:L-1;
subplot(4,1,1);stem(n,hn1,'.');line([0,45],[0,0]);ylabel('h(n)')
subplot(4,1,2);stem(n,xn,'.');line([0,45],[0,0]);ylabel('x(n)')

x0=[n<M];x0=x0.*xn;
x1=[(M<=n)&(n<2*M)];x1=x1.*xn;
x2=[(2*M<=n)&(n<3*M)];x2=x2.*xn;
x3=[(3*M<=n)&(n<4*M)];x3=x3.*xn;
subplot(4,1,3);stem(n,x0,'.');line([0,45],[0,0]);ylabel('x0(n)')
subplot(4,1,4);stem(n,x1,'.');line([0,45],[0,0]);ylabel('x1(n)')
figure(2)
subplot(4,1,1);stem(n,x2,'.');line([0,45],[0,0]);ylabel('x2(n)')
subplot(4,1,2);stem(n,x3,'.');line([0,45],[0,0]);ylabel('x3(n)')
y0=conv(hn,x0);
y1=conv(hn,x1);
y2=conv(hn,x2);
y3=conv(hn,x3);
m=0:length(y0)-1;
subplot(4,1,3);stem(m,y0,'.');line([0,45],[0,0]);ylabel('y0(n)')
subplot(4,1,4);stem(m,y1,'.');line([0,45],[0,0]);ylabel('y1(n)')
figure(3);
subplot(4,1,1);stem(m,y2,'.');line([0,45],[0,0]);ylabel('y2(n)')
subplot(4,1,2);stem(m,y3,'.');line([0,45],[0,0]);ylabel('y3(n)')
ynd=y0+y1+y2+y3;
subplot(4,1,3);
stem(m,ynd,'.');line([0,45],[0,0]);ylabel('y0+y1+y2+y3')

⌨️ 快捷键说明

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