MATLAB-通信信号与系统分析(一)

1.1离散信号和系统

1.1.1离散信号

信号的相加和相乘

  • 画出x=cos2t, 0≤ t ≤ 2π, 的抽样序列,抽样周期为Ts=0.1
t=0:0.1:2*pi;  %抽样时间
x=cos(2*t);    %抽样时刻对应的余弦函数值
stem(t,x);     %以抽样时刻为横坐标,抽样值为纵坐标画出序列

图一

  • 画出信号x1(n)=sin(2π * 0.1n)与信号x2(n)=exp(-0.1n),0≤n≤40及它们的相加和相乘序列。
n=0:40;
x1=sin(2*pi*0.1*n);
x2=exp(-0.1*n);
x=x1+x2;
y=x1.*x2;
subplot(4,1,1);stem(n,x1);title('x1')
subplot(4,1,2);stem(n,x2);title('x2')
subplot(4,1,3);stem(n,x);title('x')
subplot(4,1,4);stem(n,y);title('y')

图二

卷积和

  • 求序列h(n)=exp(-0.1n),x(n)=exp(-0.2n),0≤n≤40的卷积和。
n = 0 : 40;
h = exp (-0.1 * n);
x = exp (-0.2 * n);
y = conv(x , h);
subplot(3,1,1);stem(h);title('h')
subplot(3,1,2);stem(x);title('x')
subplot(3,1,3);stem(y);title('y')

图三

1.2 Fourier分析

可参考课件

1.2.1 连续时间信号的Fourier变换

  • 绘制连续时间信号f(t)=t*exp(-|t|)的时域波形f(t)及相应的幅频特性
syms t;
f = t * exp(-abs(t));
subplot(1,2,1);ezplot(f);
F = fourier(f);
subplot(1,2,2);ezplot(abs(F));

图四

  • 某信号的Fourier变换F(w)=πexp(-|w|),绘制信号的时域波形和频谱图
syms t w;
F = pi * exp(-abs(w));
subplot(1,2,1);ezplot(abs(F));
f = ifourier(F,t);
subplot(1,2,2);ezplot(f);

图五

1.2.2 离散时间信号的Fourier变换

离散信号h(n)的DTFT存在的条件是h(n)绝对可和,满足

  • 给定序列h(n)=1,0≤n≤20和x(n)=h(n)exp(jπn/4),分别计算他们的离散时间Fourier
w = -1:0.001:1;
n = 0:20;
h(n+1) = 1;
x = h.* exp(j * pi * n / 4);
Hjw = h * (exp(-j*pi).^(n'*w));
Xjw = x * (exp(-j*pi).^(n'*w));
subplot(2,2,1);plot(w,abs(Hjw))
title('H');xlabel('pi弧度(w)');ylabel('振幅')

subplot(2,2,2);plot(w,angle(Hjw)/pi)
title('H');xlabel('pi弧度(w)');ylabel('相位')

subplot(2,2,3);plot(w,abs(Xjw))
title('X');xlabel('pi弧度(w)');ylabel('振幅')

subplot(2,2,4);plot(w,angle(Xjw)/pi)
title('X');xlabel('pi弧度(w)');ylabel('相位')

  • 求下列序列的DTFT并绘制频谱图
    (1)h(n)=exp(-|0.1n|),-15≤n≤15
    (2)h(n)=1,0≤n≤20
w = -4:0.0001:4;
n1 = -15:15;
n2 = 0:20;
h1 = exp(-abs(0.1*n1));
h2(n2+1) = 1 ;
Hjw1 = h1 * (exp(-j*pi).^(n1'*w));
Hjw2 = h2 * (exp(-j*pi).^(n2'*w));
subplot(2,1,1);plot(w,abs(Hjw1));
title('H1');xlabel('pi弧度(w)');ylabel('振幅');
subplot(2,1,2);plot(w,abs(Hjw2));
title('H2');xlabel('pi弧度(w)');ylabel('振幅');


图六

扫描二维码关注公众号,回复: 15380499 查看本文章

1.2.3 离散Fourier变换

一个离散序列为x(n)=sin(0.2n)exp(-0.1n),0≤n≤30,求该序列的DFT
n = 0:30;
x = sin(0.2 * n) .* exp(-0.1 * n);
k = 0:30;
N = 31;
Wnk = exp(-j * 2 * pi / N) .^ (n'*k);
X = x * Wnk;
subplot(2,1,1);stem(n,x);title('系列x')
subplot(2,1,2);stem(-15:15,[abs(X(17:end)) abs(X(1:16))])
title('X幅度')

已知序列h(n)={6,3,4,2,1,-2},x(n) = {3,2,6,7,-1,-3},分别用直接法和DFT法求两个序列的循环卷积序列
h = [6 3 4 2 1 -2];
x = [3 2 6 7 -1 -3];
h1 = fliplr(h);
H = toeplitz(h,[h(1) h1(1:5)]);
y = H * x';

H = fft(h);
X = fft(x);
Y = H.*X;
y1 = ifft(Y);

subplot(2,1,1);stem(y);title('直接计算')
subplot(2,1,2);stem(y1);title('DFT计算')

猜你喜欢

转载自blog.csdn.net/qq_40843903/article/details/117674066