信号与系统实验报告
实验 信号抽样及信号重建 一、实验目的 1、进一步理解信号的抽样及抽样定理; 2、进一步掌握抽样信号的频谱分析; 3、掌握和理解信号抽样以及信号重建的原理; 二、实验内容及步骤
练习1、什么是抽样定理,信号采样后重建的步骤,抽样频率如何设置, 答:(1). 抽样,Sampling,:就是从连续时间信号中抽取一系列的信号样本,从而,得到一个离散时间序列(Discrete-time sequence).
抽样定理:设时间连续信号f(t),其最高截止频率为f m ,如果用时间间隔为T<=1/2f
m的开关信号对f(t)进行抽样时,则f(t)就可被样值信号唯一地表示。 (2).
步骤:从频域看,设信号最高频率不超过折叠频率: ,,,,Xa(j)=Xa(j) ||s/2
则理想取样后的频谱就不会产生混叠,故有:
让取样信号x^(t)通过一带宽等于折叠频率的理想低通滤波器: ,,,H(j)=T ||s/2
滤波器只允许通过基带频谱,即原信号频谱,故: ,,,,Y(j)=X^(j)H(j)=Xa(j)
因此在滤波器的输出得到了恢复的原模拟信号: y(t)=xa(t)
从时域上看,上述理想的低通滤波器的脉冲响应为:
根据卷积公式可求得理想低通滤波器的输出为:
由上式显然可得:
则:
上式表明只要满足取样频率高于两倍信号最高频率,连续时间函数xa(t)就可用他的取
样值xa(nT)来表达而不损失任何信息,这时只要把每一个取样瞬时值与内插函数式相乘求
和即可得出xa(t),在每一取样点上,由于只有该取样值所对应的内插函数式不为零,所以各
个取样点上的信号值不变。 (3).
频率设置:根据抽样定理 ws/wm的值必须大于或等于2 练习2、 给范例程序Program4_1加注释。 % Program
clear, close all, tmax = 4; dt = 0.01;
t = 0:dt:tmax;
Ts = 1/10; % Sampling period ws = 2*pi/Ts; % Sampling frequency
w0 = 20*pi; dw = 0.1; % The frequency of x(t) w = -w0:dw:w0;
n = 0:1:tmax/Ts; % Make the time variable to be discrete x = exp(-4*t).*u(t);
xn = exp(-4*n*Ts); % The sampled version of x(t) subplot(221) % Plot the original signal x(t) plot(t,x), title('A continuous-time signal x(t)'), xlabel('Time t'), axis([0,tmax,0,1]), grid on subplot(223) % Plot xn
stem(n,xn,'.'), title('The sampled version x[n] of x(t)'), xlabel('Time index n'), axis([0,tmax/Ts,0,1]), grid on Xa = x*exp(-j*t'*w)*dt; X = 0;
for k = -8:8; % Periodically extend X to form a periodic signal X = X + x*exp(-j*t'*(w-k*ws))*dt; end
subplot(222) % Plot xa plot(w,abs(Xa))
title('Magnitude spectrum of x(t)'), grid on axis([-60,60,0,1.8*max(abs(Xa))]) subplot(224)
plot(w,abs(X))
title('Magnitude spectrum of x[n]'), xlabel('Frequency in radians/s'),grid on axis([-60,60,0,1.8*max(abs(Xa))])
练习3、分别进行设置ws/wm= 2,ws/wm= 1,ws/wm= 3,并运行抽样信号重建程序,
并根据抽样定理及重建条件分析三种设置情况下的结果。 % The original signal is the raised cosin signal: x(t) = [1+cos(pi*t)].*[u(t+1)-u(t-1)]. clear; close all,
wm = 2*pi; % The highest frequency of x(t) a = input('Type in the frequency rate ws/wm=:'); % ws is the sampling frequency wc = wm; % The cutoff frequency of the ideal lowpass filter t0 = 2; t = -t0:0.01:t0;
x = (1+cos(pi*t)).*(u(t+1)-u(t-1));
subplot(221); % Plot the original signal x(t) plot(t,x); grid on, axis([-2,2,-0.5,2.5]);
title('Original signal x(t)');xlabel('Time t');
ws = a*wm; % Sampling frequency Ts = 2*pi/ws; % Sampling period N = fix(t0/Ts); % Determine the number of samplers n = -N:N; nTs = n*Ts; % The discrete time variable xs =
(1+cos(pi*nTs)).*(u(nTs+1)-u(nTs-1)); % The sampled version of x(t) subplot(2,2,2) % Plot xs
stem(n,xs,'.'); xlabel('Time index n'); grid on, title('Sampled version x[n]'); xr = zeros(1,length(t)); % Specify a memory to save the reconstructed signal L = length(-N:N);
xa = xr;