Use kron to build a matrix
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jyoti Mangal
el 24 de Mayo de 2021
Comentada: Stephen23
el 25 de Mayo de 2021
Hi,
I would like to build a matrix that resembles something like
A = [-1 1 0 0 0 0 0 0;
0 -1 1 0 0 0 0 0;
0 0 -1 1 0 0 0 0;
0 0 0 -1 1 0 0 0;
0 0 0 0 -1 1 0 0;
0 0 0 0 0 -1 1 0;
0 0 0 0 0 0 -1 1];
Can I use kron function to build something like this? One of the things that needs to be a variable will be the number of rows, so I need my kron function to be flexible such that it can build more such matrices, for eg. a matrix with four such rows would look like
A = [-1 1 0 0 0;
0 -1 1 0 0;
0 0 -1 1 0;
0 0 0 -1 1;]
Also happy to do using any other method than kron. Thank you for your help.
0 comentarios
Respuesta aceptada
Más respuestas (1)
Sulaymon Eshkabilov
el 24 de Mayo de 2021
Hi,
In you exercise, use eye() and kron(). and then change the necessary element of the generated matrix if necessary.
Good luck
0 comentarios
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!