MATLAB里实现对一个信号的抽样[习题0.13]

题目描述
考虑信号 x ( t ) = 4 c o s ( 2 π t ) , − ∞ < t < ∞ x(t)=4cos(2\pi{t}),-\infty<t<\infty x(t)=4cos(2πt),<t<,以不同的抽样时间间隔对其进行抽样,产生的离散时间信号是 x ( n ) = x ( n T s ) x(n)=x(nT_{s}) x(n)=x(nTs),(1) T s = 0.1 ; ( 2 ) T s = 0.5 ; ( 3 ) T s = 1 T_{s}=0.1;(2)T_{s}=0.5;(3)T_{s}=1 Ts=0.1;(2)Ts=0.5;(3)Ts=1
对于以上所给的 T s T_{s} Ts值,判断哪个离散时间信号损失了连续时间信号中的信息。用 m a t l a b matlab matlab画出 0 ≤ t ≤ 3 0\leq{t}\leq{3} 0t3内的 x ( t ) x(t) x(t)(取 T s = 1 0 − 4 , 用 p l o t 函 数 ) T_{s}=10^{-4},用plot函数) Ts=104,plot)以及抽样所得的离散时间信号(用 s t e m stem stem函数)的图形,将模拟和数字信号画在一张图上;利用 s u b p l o t subplot subplot函数将一个图形窗口分成四个图形区域。注意要解决如何标注不同的坐标轴,如何使两个图形的尺度和单位相同的问题。

考察点:奈奎斯特采样定理

我们在后面将看到,频率为 Ω = 2 π f m a x = 2 π \varOmega=2\pi{f_{max}}=2\pi Ω=2πfmax=2π的信号 x ( t ) x(t) x(t)必须满足奈奎斯特采样定理
f s = 1 T s ≥ 2 f m a x = 2 ( s a m p l e / s e c ) f_{s}=\frac{1}{T_{s}}\geq2{f_{max}}=2(sample/sec) fs=Ts12fmax=2(sample/sec)
因此 T s ≤ 1 2 ( s e c / s a m p l e ) T_{s}\leq{\frac{1}{2}(sec/sample)} Ts21(sec/sample),因此当 T s = 0.1 T_{s}=0.1 Ts=0.1时,连续时间和离散时间看起来非常相似,表明信号具有相同的信息。在采样一章中,我们将证明连续的时间信号可以从采样信号中恢复。很明显,当 T s = 0.1 T_{s}=0.1 Ts=0.1时,信息丢失。尽管从图中不清楚,当 T s = 0.5 T_{s}=0.5 Ts=0.5时,离散时间信号保持信息。但该采样周期满足奈奎斯特采样条件。因此可以从采样信号中恢复信号。 M A T L A B MATLAB MATLAB源代码如下:

% 0.13.信号的采样
clc;clear;
% 采样时间选取,采样间隔为0.0001s
T=3;Tss=0.0001;t=[0:Tss:T];
% 连续时间信号
xa=4*cos(2*pi*t);
xamin=min(xa);xamax=max(xa);
figure(1)
subplot(221)
plot(t,xa);grid
title('连续时间信号');ylabel('x(t)');xlabel('t sec');
%绘制坐标轴
axis([0 T 1.5*xamin 1.5*xamax])
N=length(t);
%总共有三组采样周期,那么我们就需要循环三次
for k=1:3
    %采样周期为0.1时,其中t为[0:0.1:3]的矩阵我们建立了一个30001个元素的矩阵,同时采集31组数据
    if k==1,Ts=0.1;subplot(222);
        t1=[0:Ts:T];n=1:Ts/Tss:N;xd=zeros(1,N);xd(n)=4*cos(2*pi*t1);
        plot(t,xa);hold on;stem(t,xd);grid;hold off
        axis([0 T 1.5*xamin 1.5*xamax]);ylabel('x(0.1 n)');xlabel('t')
    elseif k==2,Ts=0.5;subplot(223)
        t2=[0:Ts:T];n=1:Ts/Tss:N;xd=zeros(1,N);xd(n)=4*cos(2*pi*t2);
        plot(t,xa);hold on;stem(t,xd);grid;hold off
        axis([0 T 1.5*xamin 1.5*xamax]);ylabel('x(0.5 n)');xlabel('t')
    else Ts=1;subplot(224)
        t3=[0:Ts:T];n=1:Ts/Tss: N;xd=zeros(1,N);xd(n)=4*cos(2*pi*t3);
        plot(t,xa); hold on;stem(t,xd); grid; hold off
        axis([0 T 1.5*xamin 1.5*xamax]); ylabel('x(n)'); xlabel('t')
    end
end
        
     

在这里插入图片描述
我们可以轻松的看出, T s ≤ 0.5 T_{s}\leq{0.5} Ts0.5时可以无失真的恢复信号。

  • 2
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值