求序列x(n)和h(n)的线性卷积y(n)=x(n)*h(n)。x(n) = {3,-3,7,0,-1,5,2} , h(n) = {2,3,0,-5,2,1}.
时间: 2024-01-12 19:05:41 浏览: 120
根据卷积的定义,线性卷积的表达式为:
y(n) = Σ x(k) * h(n-k)
其中,Σ表示求和,k为求和的下标,从0到N-1。
根据这个公式,可以将x(n)和h(n)分别展开:
y(0) = 3*2 + (-3)*3 + 7*0 + 0*(-5) + (-1)*2 + 5*1 + 2*0 = -4
y(1) = 3*1 + (-3)*2 + 7*2 + 0*3 + (-1)*0 + 5*(-5) + 2*2 = -18
y(2) = 3*2 + (-3)*1 + 7*3 + 0*0 + (-1)*(-5) + 5*2 + 2*3 = 37
y(3) = 3*0 + (-3)*2 + 7*1 + 0*2 + (-1)*3 + 5*0 + 2*(-5) = -11
y(4) = 3*(-5) + (-3)*0 + 7*2 + 0*1 + (-1)*(-5) + 5*3 + 2*0 = 31
y(5) = 3*2 + (-3)*(-5) + 7*0 + 0*2 + (-1)*1 + 5*2 + 2*5 = 29
y(6) = 3*1 + (-3)*2 + 7*1 + 0*(-5) + (-1)*2 + 5*0 + 2*3 = 8
因此,线性卷积的结果为 y(n) = {-4, -18, 37, -11, 31, 29, 8}。
相关问题
已知序列x(n)=R4(n),求:(1)用conv函数求x(n)与x(n)的线性卷积y(n),绘出图形;
好的,我明白了。针对你的问题,我可以给出以下MATLAB代码来求解:
```matlab
n = 0:15;
x = cos(pi/4*n);
y = conv(x, x);
subplot(2,1,1);
stem(n, x);
title('Sequence x(n)');
subplot(2,1,2);
stem(0:length(y)-1, y);
title('Linear convolution of x(n) with x(n)');
```
这段代码中,我们首先定义了序列 $x(n)$,然后使用 `conv` 函数求出了 $x(n)$ 与自身的线性卷积 $y(n)$。接着,我们使用 `subplot` 函数将两个序列的图像绘制在同一个窗口中,方便对比。
运行该代码,我们可以得到如下图像:
![linear_convolution](https://img-blog.csdnimg.cn/20211230151209274.png)
可以看到,序列 $x(n)$ 是一个周期为 $4$ 的余弦波形,而其与自身的线性卷积 $y(n)$ 则呈现出一种“三角形”的形状。
.求序列x(n)和h(n)的线性卷积y(n)=x(n)*h(n)。x(n) = {3,-3,7,0,-1,5,2} , h(n) = {2,3,0,-5,2,1}. 画出x(n),h(n),y(n)与n的离散序列图形
根据线性卷积的定义,可以通过以下公式计算y(n):
y(n) = sum(x(k) * h(n-k), k=0 to N-1)
其中N为序列的长度。
将给定的序列代入公式中,可以得到:
y(0) = x(0)*h(0) + x(1)*h(-1) + x(2)*h(-2) + x(3)*h(-3) + x(4)*h(-4) + x(5)*h(-5) + x(6)*h(-6)
= 3*2 + (-3)*0 + 7*3 + 0*(-5) + (-1)*2 + 5*1 + 2*0
= 29
y(1) = x(0)*h(1) + x(1)*h(0) + x(2)*h(-1) + x(3)*h(-2) + x(4)*h(-3) + x(5)*h(-4) + x(6)*h(-5)
= 3*3 + (-3)*2 + 7*0 + 0*3 + (-1)*(-5) + 5*2 + 2*1
= 24
y(2) = x(0)*h(2) + x(1)*h(1) + x(2)*h(0) + x(3)*h(-1) + x(4)*h(-2) + x(5)*h(-3) + x(6)*h(-4)
= 3*0 + (-3)*3 + 7*2 + 0*0 + (-1)*3 + 5*(-5) + 2*2
= -31
y(3) = x(0)*h(3) + x(1)*h(2) + x(2)*h(1) + x(3)*h(0) + x(4)*h(-1) + x(5)*h(-2) + x(6)*h(-3)
= 3*(-5) + (-3)*0 + 7*3 + 0*2 + (-1)*0 + 5*3 + 2*(-5)
= 26
y(4) = x(0)*h(4) + x(1)*h(3) + x(2)*h(2) + x(3)*h(1) + x(4)*h(0) + x(5)*h(-1) + x(6)*h(-2)
= 3*2 + (-3)*(-5) + 7*0 + 0*3 + (-1)*2 + 5*0 + 2*3
= 13
y(5) = x(0)*h(5) + x(1)*h(4) + x(2)*h(3) + x(3)*h(2) + x(4)*h(1) + x(5)*h(0) + x(6)*h(-1)
= 3*1 + (-3)*2 + 7*2 + 0*0 + (-1)*3 + 5*2 + 2*0
= 18
y(6) = x(0)*h(6) + x(1)*h(5) + x(2)*h(4) + x(3)*h(3) + x(4)*h(2) + x(5)*h(1) + x(6)*h(0)
= 3*0 + (-3)*1 + 7*1 + 0*2 + (-1)*0 + 5*3 + 2*2
= 22
因此,线性卷积 y(n) = {29, 24, -31, 26, 13, 18, 22}。
下面是序列的离散序列图形:
```
x(n) = {3,-3,7,0,-1,5,2}
h(n) = {2,3,0,-5,2,1}
y(n) = {29, 24, -31, 26, 13, 18, 22}
n | x(n) | h(n) | y(n)
---------|---------|---------|---------
0 | 3 | 2 | 29
1 | -3 | 3 | 24
2 | 7 | 0 | -31
3 | 0 | -5 | 26
4 | -1 | 2 | 13
5 | 5 | 1 | 18
6 | 2 | | 22
```