Main Content

hankel

Description

H = hankel(c) returns a square Hankel Matrix where c defines the first column of the matrix, and the elements are zero below the main anti-diagonal.

example

H = hankel(c,r) returns a Hankel matrix with c as its first column and r as its last row. If the last element of c differs from the first element of r, then hankel issues a warning and uses the last element of c for the anti-diagonal.

example

Examples

collapse all

Create a symmetric Hankel matrix.

c = [1 2 3 4];
hankel(c)
ans = 4×4

     1     2     3     4
     2     3     4     0
     3     4     0     0
     4     0     0     0

Create a nonsymmetric Hankel matrix with specified column and row vectors.

c = [2 4 6];
r = [6 5 4 3 2 1];
hankel(c,r)
ans = 3×6

     2     4     6     5     4     3
     4     6     5     4     3     2
     6     5     4     3     2     1

Create another nonsymmetric Hankel matrix. If the last element of the column vector does not match the first element of the row vector, hankel issues a warning and uses the last element of the column for the anti-diagonal element.

c = [1 2 3];
r = [4 5 7 9];
hankel(c,r)
Warning: Last element of input column does not match first element of input row. 
         Column wins anti-diagonal conflict.
ans = 3×4

     1     2     3     5
     2     3     5     7
     3     5     7     9

Create a Hankel matrix with complex row and column vectors.

c = [1+2i 2-4i -1+3i];
r = [-1+3i 3-1i 1-2i];
hankel(c,r)
ans = 3×3 complex

   1.0000 + 2.0000i   2.0000 - 4.0000i  -1.0000 + 3.0000i
   2.0000 - 4.0000i  -1.0000 + 3.0000i   3.0000 - 1.0000i
  -1.0000 + 3.0000i   3.0000 - 1.0000i   1.0000 - 2.0000i

Input Arguments

collapse all

First column of Hankel matrix, specified as a scalar or a vector.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

Last row of Hankel matrix, specified as a scalar or a vector. If the last element of c differs from the first element of r, then hankel uses the last element of c for the anti-diagonal.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Complex Number Support: Yes

More About

collapse all

Hankel Matrix

A Hankel matrix is a matrix in which the elements along each anti-diagonal are equal:

H=[c1c2c3c2c3c3cm1cmr2rn2cm1cmr2rn2rn1cmr2rn2rn1rn].

If c is the first column of the Hankel matrix and r is the last row of the Hankel matrix, then p = [c r(2:end)] completely determines all elements of the Hankel matrix using the mapping Hi,j = pi+j-1. All square Hankel matrices are symmetric.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also

| |