Add two rows in a matrix with new datas

3 visualizaciones (últimos 30 días)
Frederike Petersen
Frederike Petersen el 6 de Oct. de 2021
Comentada: Frederike Petersen el 6 de Oct. de 2021
I have a pascal triangle matrix pascal(10) = E. Now I have to calculate the mean and the standard deviation of each column of E. The results have to insert as row 6&7 in Matrix E. (At the end the matrix should have [12 10]).
Thanks for your advices!

Respuesta aceptada

C B
C B el 6 de Oct. de 2021
Editada: C B el 6 de Oct. de 2021
you can do this in below way
E = pascal(10);
k = 5;
E = [E(1:k,:); std(E); E(k+1:end,:)];
k = 6;
E = [E(1:k,:); mean(E); E(k+1:end,:)];

Más respuestas (1)

KSSV
KSSV el 6 de Oct. de 2021
E = pascal(10) ;
iwant = [E ; mean(E) ; std(E)]
iwant = 12×10
1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 1 3 6 10 15 21 28 36 45 55 1 4 10 20 35 56 84 120 165 220 1 5 15 35 70 126 210 330 495 715 1 6 21 56 126 252 462 792 1287 2002 1 7 28 84 210 462 924 1716 3003 5005 1 8 36 120 330 792 1716 3432 6435 11440 1 9 45 165 495 1287 3003 6435 12870 24310 1 10 55 220 715 2002 5005 11440 24310 48620
  2 comentarios
C B
C B el 6 de Oct. de 2021
I think he want to insert at 6th and 7th row
Frederike Petersen
Frederike Petersen el 6 de Oct. de 2021
thank you!

Iniciar sesión para comentar.

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by