How to create a diagonal matrix that starts at (1,1)?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Renea Young
il 21 Nov 2021
Risposto: Star Strider
il 21 Nov 2021
Can someone help me?
How do I create a diagonal matrix of lambda, where lambda = 0.2? I would like the diagonal to start at (1,1).
Any help would be greatly appreciated.
3 Commenti
Risposta accettata
Star Strider
il 21 Nov 2021
Without using repmat —
n = 4;
lambda = 0.2;
A = diag([0 ones(1,n)]*lambda)
,
0 Commenti
Più risposte (2)
Jan
il 21 Nov 2021
Maybe you mean:
n = 4;
lambda = 0.2;
A = eye(n) * lambda
% Or:
A = diag(repmat(lambda, 1, n))
0 Commenti
Vedere anche
Categorie
Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!