toeplitz
托普利茨矩阵
说明
示例
创建具有指定的列和行向量的非对称托普利茨矩阵。因为列向量和行向量的首个元素不匹配,toeplitz
发出警告并使用列作为对角线元素。
c = [1 2 3 4]; r = [4 5 6]; toeplitz(c,r)
Warning: First element of input column does not match first element of input row. Column wins diagonal conflict.
ans = 4×3
1 5 6
2 1 5
3 2 1
4 3 2
创建包含复数行和列向量的托普利茨矩阵。
c = [1+3i 2-5i -1+3i]; r = [1+3i 3-1i -1-2i]; T = toeplitz(c,r)
T = 3×3 complex
1.0000 + 3.0000i 3.0000 - 1.0000i -1.0000 - 2.0000i
2.0000 - 5.0000i 1.0000 + 3.0000i 3.0000 - 1.0000i
-1.0000 + 3.0000i 2.0000 - 5.0000i 1.0000 + 3.0000i
您可以使用 toeplitz
创建循环矩阵。循环矩阵在循环卷积等应用中使用。
使用 toeplitz 从向量 v
创建循环矩阵。
v = [9 1 3 2]; toeplitz([v(1) fliplr(v(2:end))], v)
ans = 4×4
9 1 3 2
2 9 1 3
3 2 9 1
1 3 2 9
通过使用 toeplitz
为卷积构建循环矩阵来执行离散时间的循环卷积。
定义周期性输入 x
和系统响应 h
。
x = [1 8 3 2 5]; h = [3 5 2 4 1];
构建列向量 c
以创建循环矩阵,其中 length(c) = length(h)
。
c = [x(1) fliplr(x(end-length(h)+2:end))]
c = 1×5
1 5 2 3 8
从 x
构建行向量 r
。
r = x;
使用 toeplitz
构建卷积矩阵 xConv
。使用 h*xConv
求卷积。
xConv = toeplitz(c,r)
xConv = 5×5
1 8 3 2 5
5 1 8 3 2
2 5 1 8 3
3 2 5 1 8
8 3 2 5 1
h*xConv
ans = 1×5
52 50 73 46 64
如果您有 Signal Processing Toolbox™,则可以使用 cconv
(Signal Processing Toolbox) 函数求循环卷积。
通过使用 toeplitz
为卷积构建数组,执行离散时间卷积。
定义输入 x
和系统响应 h
。
x = [1 8 3 2 5]; h = [3 5 2];
通过用 0 填充 x
构建 r
。r
的长度是卷积长度 x + h - 1
。
r = [x zeros(1,length(h)-1)]
r = 1×7
1 8 3 2 5 0 0
构建列向量 c
。将第一个元素设置为 x(1)
,因为该列确定对角线。填充 c
,因为 length(c)
必须等于卷积的 length(h)
。
c = [x(1) zeros(1,length(h)-1)]
c = 1×3
1 0 0
使用 toeplitz
构建卷积矩阵 xConv
。然后,使用 h*xConv
求卷积。
xConv = toeplitz(c,r)
xConv = 3×7
1 8 3 2 5 0 0
0 1 8 3 2 5 0
0 0 1 8 3 2 5
h*xConv
ans = 1×7
3 29 51 37 31 29 10
使用 conv
检查结果是正确的。
conv(x,h)
ans = 1×7
3 29 51 37 31 29 10
输入参数
托普利茨矩阵的列,指定为标量或向量。如果 c
和 r
的首个元素不同,toeplitz
将使用列元素作为对角线。
数据类型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
复数支持: 是
托普利茨矩阵的行,指定为标量或向量。如果 c
和 r
的首个元素不同,则 toeplitz
将使用列元素作为对角线。
数据类型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
复数支持: 是
详细信息
托普利茨矩阵是对角线为常量的矩阵,这意味着沿对角线的所有元素都具有相同的值。对于托普利茨矩阵 A,Ai,j = ai–j,结果的形式如下:
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
toeplitz
函数完全支持 GPU 数组。要在 GPU 上运行该函数,请将输入数据指定为 gpuArray
(Parallel Computing Toolbox)。有关详细信息,请参阅在 GPU 上运行 MATLAB 函数 (Parallel Computing Toolbox)。
此函数完全支持分布式数组。有关详细信息,请参阅使用分布式数组运行 MATLAB 函数 (Parallel Computing Toolbox)。
版本历史记录
在 R2006a 之前推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)