How to fast create a specific matrix

2 vues (au cours des 30 derniers jours)
Xiaolong
Xiaolong le 21 Juin 2019
Commenté : Xiaolong le 21 Juin 2019
I want to generate a matrix with the same pattern but different size.
pattern: for a matrix with size [4 4]
[ 0 0 0 0;
0 0 0 1;
0 0 1 2;
0 1 2 3]
The matrix is always square. The size is often more than 256 in practice. I can generate this kind of matrix using for-loop. But it's too slow.
How to fast create this kind of matrix?

Réponse acceptée

Matt J
Matt J le 21 Juin 2019
hankel(zeros(1,4),0:3)
  1 commentaire
Xiaolong
Xiaolong le 21 Juin 2019
Clean and Clear

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by