# hankel

## Syntax

``H = hankel(c)``
``H = hankel(c,r)``

## Description

example

````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.```

## 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

collapse all

### Hankel Matrix

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

`$H=\left[\begin{array}{ccccccc}{c}_{1}& {c}_{2}& {c}_{3}& \cdots & \cdots & \cdots & \cdots \\ {c}_{2}& {c}_{3}& ⋰& ⋰& ⋰& ⋰& ⋮\\ {c}_{3}& ⋰& ⋰& ⋰& ⋰& ⋰& ⋮\\ ⋮& {c}_{m-1}& {c}_{m}& {r}_{2}& ⋰& ⋰& {r}_{n-2}\\ {c}_{m-1}& {c}_{m}& {r}_{2}& ⋰& ⋰& {r}_{n-2}& {r}_{n-1}\\ {c}_{m}& {r}_{2}& \cdots & \cdots & {r}_{n-2}& {r}_{n-1}& {r}_{n}\end{array}\right].$`

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.

## Version History

Introduced before R2006a