简体   繁体   中英

how can i create a matrix using vector with lag using matlab

vector=
3
4
8
5
2
1
6

the matrix i want to create is
3 0 0
4 3 0
8 4 3
5 8 4
2 5 8
1 2 5
6 1 2

This was already covered in one of your previous questions . Although you aren't trying to create a square matrix in this example, you can still use the TOEPLITZ function like in Jonas' answer :

M = toeplitz(vector,[vector(1) 0 0]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM