toeplitz
Toeplitz matrix
Description
T = toeplitz(
returns
a nonsymmetric Toeplitz
matrix with c
,r
)c
as its first column and r
as
its first row. If the first elements of c
and r
differ, toeplitz
issues
a warning and uses the column element for the diagonal.
T = toeplitz(
returns
the symmetric Toeplitz matrix where:r
)
If
r
is a real vector, thenr
defines the first row of the matrix.If
r
is a complex vector with a real first element, thenr
defines the first row andr'
defines the first column.If the first element of
r
is complex, the Toeplitz matrix is Hermitian off the main diagonal, which means for . The elements of the main diagonal are set tor(1)
.
Examples
Create Symmetric Toeplitz Matrix
Create Nonsymmetric Toeplitz Matrix
Create a nonsymmetric Toeplitz matrix with a specified column and row vector. Because the first elements of the column and row vectors do not match, toeplitz
issues a warning and uses the column for the diagonal element.
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
Create a Toeplitz matrix with complex row and column vectors.
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
Create Circulant Matrices Using toeplitz
Function
You can create circulant matrices using toeplitz
. Circulant matrices are used in applications such as circular convolution.
Create a circulant matrix from vector v
using toeplitz.
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
Perform discrete-time circular convolution by using toeplitz
to form the circulant matrix for convolution.
Define the periodic input x
and the system response h
.
x = [1 8 3 2 5]; h = [3 5 2 4 1];
Form the column vector c
to create a circulant matrix where length(c) = length(h)
.
c = [x(1) fliplr(x(end-length(h)+2:end))]
c = 1×5
1 5 2 3 8
Form the row vector r
from x
.
r = x;
Form the convolution matrix xConv
using toeplitz
. Find the convolution using 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
If you have the Signal Processing Toolbox™, you can use the cconv
(Signal Processing Toolbox) function to find the circular convolution.
Discrete-Time Convolution Using Toeplitz
Perform discrete-time convolution by using toeplitz
to form the arrays for convolution.
Define the input x
and system response h
.
x = [1 8 3 2 5]; h = [3 5 2];
Form r
by padding x
with zeros. The length of r
is the convolution length x + h - 1
.
r = [x zeros(1,length(h)-1)]
r = 1×7
1 8 3 2 5 0 0
Form the column vector c
. Set the first element to x(1)
because the column determines the diagonal. Pad c
because length(c)
must equal length(h)
for convolution.
c = [x(1) zeros(1,length(h)-1)]
c = 1×3
1 0 0
Form the convolution matrix xConv
using toeplitz
. Then, find the convolution using 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
Check that the result is correct using conv
.
conv(x,h)
ans = 1×7
3 29 51 37 31 29 10
Input Arguments
c
— Column of Toeplitz matrix
scalar | vector
Column of Toeplitz matrix, specified as a scalar or vector.
If the first elements of c
and r
differ, toeplitz
uses
the column element for the diagonal.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Complex Number Support: Yes
r
— Row of Toeplitz matrix
scalar | vector
Row of Toeplitz matrix, specified as a scalar or vector. If
the first elements of c
and r
differ,
then toeplitz
uses the column element for the
diagonal.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Complex Number Support: Yes
More About
Toeplitz Matrix
A Toeplitz matrix is a diagonal-constant matrix, which means all elements along a diagonal have the same value. For a Toeplitz matrix A, we have Ai,j = ai–j which results in the form
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The toeplitz
function
fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray
(Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Version History
Introduced before 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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)