Shifting elements and replacing empty places with zeros

1 visualizzazione (ultimi 30 giorni)
How to convert matrix A =[3 ,7, 9, 2] to matrix B = [3, 7, 9, 2; 0, 3, 9, 2; 0, 0, 3, 9; 0, 0, 0, 3] using matlab

Risposta accettata

Matt J
Matt J il 24 Ago 2023
Modificato: Matt J il 24 Ago 2023
The B that you have provided is not what the title of your post describes. I assume you meant the following,
A =[3 ,7, 9, 2];
B=toeplitz([A(1),zeros(1,numel(A)-1)],A)
B = 4×4
3 7 9 2 0 3 7 9 0 0 3 7 0 0 0 3
  5 Commenti
Matt J
Matt J il 29 Ago 2023
No, because that would probably be a homework problem.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by