Borrar filtros
Borrar filtros

Writing a Nth order matrix.

6 visualizaciones (últimos 30 días)
JA
JA el 11 de Ag. de 2016
Editada: Stephen23 el 11 de Ag. de 2016
I want to create a ' nxn' matrix but it's not an identity matrix. As I don't know how to write matrix on Matlab Answers, I created them on latex and took screenshots, hopefully that's sufficient .The type of matrix i want to create is:
Where the coefficients a1, a2,...... an are known, and basically the order of matrix n is nothing but length(a)
few example of what i mean:
.
The only condition being n >= 2, because if n = 1, then the whole concept falls apart. I am kinda blank on how to proceed with these kinda matrix.

Respuesta aceptada

Stephen23
Stephen23 el 11 de Ag. de 2016
Editada: Stephen23 el 11 de Ag. de 2016
Just keep it simple:
>> a = 1:5;
>> M = diag(ones(1,numel(a)-1),1);
>> M(end,:) = a
M =
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 2 3 4 5

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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!

Translated by