Learn R Programming

pracma (version 0.5-3)

diffmat: Difference Matrix

Description

Difference matrix of a numeric vector.

Usage

diffmat(x)

Arguments

x
Numeric vector.

Value

  • Numeric n-by-n matrix, where n=length(x).

Details

The vector x sits in the diagonal, and the i-th difference vector in both i-th secondary diagonals.

Examples

Run this code
x <- c(1,2,3,5,7,11,13,17,19)
(A <- diffmat(x))

Run the code above in your browser using DataLab