matlab conv 多项式,【 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,shape) returns a subsection of the convolution, as specified by 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.

9f12f9547620182f04fc58ffdf52e391.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值