【 MATLAB 】conv 函数介绍(卷积和多项式乘法)
【摘要】 conv
Convolution and polynomial multiplication
Syntax
w = conv(u,v)
w = conv(u,v,shape)
Description
w = conv(u,v)返回向量u和v的卷积。如果u和v是多项式系数的向量,则对它们进行卷积相当于将两个多项式相乘。
w = conv(u,v,s...
conv
Convolution and polynomial multiplication
Syntax
w = conv(u,v)
w = conv(u,v,shape)
Description
w = conv(u,v)返回向量u和v的卷积。如果u和v是多项式系数的向量,则对它们进行卷积相当于将两个多项式相乘。
w = conv(
returns a subsection of the convolution, as specified by u,v
,shape
)shape
. For example, conv(u,v,'same')
returns only the central part of the convolution, the same size as u
, and conv(u,v,'valid')
returns only the part of the convolution computed without the zero-padded edges.
w = conv(u,v,shape)返回卷积的子部分,由形状指定。
例如,conv(u,v,'same')仅返回卷积的中心部分,与u的大小相同,而conv(u,v,'valid')仅返回计算后的卷积部分而没有零填充边。
Polynomial Multiplication via Convolution
Create vectors u
and v
containing the coefficients of the polynomials x^2 + 1 and 2x + 7.
u = [1 0 1];
v = [2 7];
Use convolution to multiply the polynomials.
w = conv(u,v)
w = 1×4 2 7 2 7
w
contains the polynomial coefficients for 2x^3 + 7x^2 + 2x + 7.
Vector Convolution
Create two vectors and convolve them.
u = [1 1 1];
v = [1 1 0 0 0 1 1];
w = conv(u,v)
w = 1×9 1 2 2 1 0 1 2 2 1
The length of w
is length(u)+length(v)-1
, which in this example is 9
.
Central Part of Convolution
Create two vectors. Find the central part of the convolution of u
and v
that is the same size as u
.
u = [-1 2 3 -2 0 1 2];
v = [2 4 -1 1];
w = conv(u,v,'same')
w = 1×7 15 5 -9 7 6 7 -1
w
has a length of 7
. The full convolution would be of length length(u)+length(v)-1
, which in this example would be 10.
文章来源: reborn.blog.csdn.net,作者:李锐博恩,版权归原作者所有,如需转载,请联系作者。
原文链接:reborn.blog.csdn.net/article/details/83279843
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)