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

📄 project_1.m

📁 本文件夹共三个matlab文件和一个word文档
💻 M
字号:
%项目一 用MATLAB验证时域抽样定理
TN=0.05;TNN=0.005;  %前者为抽样间隔 后者是对原始信号采样画图
Ts1=0.02;Ts2=0.08;  %两种抽样时间 分别><抽样间隔TN
n=-200:200;nN=-2000:2000; %抽样长度
nTs1=n*Ts1;nTs2=n*Ts2;nTN=n*TN;nTNN=n*TNN;
%以小于抽样间隔抽样
fs1=cos(8*pi*nTs1)+2*sin(40*pi*nTs1)+cos(24*pi*nTs1); %抽样信号
ft=cos(8*pi*nTNN)+2*sin(40*pi*nTNN)+cos(24*pi*nTNN);  %原始信号
y1=fs1*Ts1*40*sinc(40*(ones(length(nTs1),1)*nTs1-nTs1'*ones(1,length(nTs1)))); %重构信号
error1=abs(fs1-y1);
subplot(2,3,1);
stem(nTs1,fs1,'color','r');
hold on;
plot(nTNN,ft);
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;
subplot(2,3,2);
plot(nTs1,y1);
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;
subplot(2,3,3);
plot(nTs1,error1,'color','g');
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;
%以大于抽样间隔抽样
fs2=cos(8*pi*nTs2)+2*sin(40*pi*nTs2)+cos(24*pi*nTs2);
ft=cos(8*pi*nTNN)+2*sin(40*pi*nTNN)+cos(24*pi*nTNN);
y2=fs2*Ts2*40*sinc(40*(ones(length(nTs2),1)*nTs2-nTs2'*ones(1,length(nTs2))));
error2=abs(fs2-y2);
subplot(2,3,4);
stem(nTs2,fs2,'color','r');
hold on;
plot(nTNN,ft);
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;
subplot(2,3,5);
plot(nTs2,y2);
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;
subplot(2,3,6);
plot(nTs2,error2,'color','g');
xlim([-0.5,0.5]);ylim([-4,4]);
grid on;

⌨️ 快捷键说明

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