【 MATLAB 】z 变换中的卷积与解卷积
关于卷积的博文,之前也写过几篇:
【 MATLAB 】两个序列的卷积和运算的MATLAB实现(1)
【 MATLAB 】两个序列的卷积和运算的MATLAB实现(2)
今天在z变换的应用场景中再写一篇,另外加上另外一个知识点解卷积deconv。
z变换的卷积性质为:
例题1:
设
求:
-
clc
-
clear
-
close all
-
-
n1 = 0:2;
-
x1 = [2,3,4];
-
n2 = 0:3;
-
x2 = [3,4,5,6];
-
-
n3 = min(n1)+min(n2):max(n1)+max(n2);
-
x3 = conv(x1,x2)
-
-
subplot(3,1,1);
-
stem(n1,x1);
-
title('x1(n)');
-
-
subplot(3,1,2);
-
stem(n2,x2);
-
title('x2(n)');
-
-
subplot(3,1,3);
-
stem(n3,x3);
-
title('x1(n)*x2(n)');
卷积后的下标也可以表示成:
-
n3b = n1(1) + n2(1);
-
n3e = n1(length(x1)) + n2(length(x2));
-
n3 = n3b:n3e;
-
% n3 = min(n1)+min(n2):max(n1)+max(n2);
-
x3 = conv(x1,x2)
x3 =
6 17 34 43 38 24
所以,
[p,r]=deconv(x3,x1)
rlogic = (r == 0)
plogic=(p == x2)
继续运行这三条语句可得:
p =
3 4 5 6
r =
0 0 0 0 0 0
rlogic =
1×6 logical 数组
1 1 1 1 1 1
plogic =
1×4 logical 数组
1 1 1 1
可见p = x2,这就是解卷积,也就是 p = x3 / x1 = x2;
例题2:
设
求:
直接给出MATLAB脚本:
-
clc
-
clear
-
close all
-
-
n1 = -1:1;
-
x1 = [1,2,3];
-
n2 = -2:1;
-
x2 = [2,4,3,5];
-
-
n3b = n1(1) + n2(1);
-
n3e = n1(length(x1)) + n2(length(x2));
-
n3 = n3b:n3e
-
% n3 = min(n1)+min(n2):max(n1)+max(n2);
-
x3 = conv(x1,x2)
-
-
subplot(3,1,1);
-
stem(n1,x1);
-
title('x1(n)');
-
-
subplot(3,1,2);
-
stem(n2,x2);
-
title('x2(n)');
-
-
subplot(3,1,3);
-
stem(n3,x3);
-
title('x1(n)*x2(n)');
-
-
[x2,r]=deconv(x3,x1)
-
n3 =
-3 -2 -1 0 1 2
x3 =
2 8 17 23 19 15
x2 =
2 4 3 5
r =
0 0 0 0 0 0
文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。
原文链接:reborn.blog.csdn.net/article/details/83420386
- 点赞
- 收藏
- 关注作者
评论(0)