Filter löschen
Filter löschen

Add two rows in a matrix with new datas

1 Ansicht (letzte 30 Tage)
Frederike Petersen
Frederike Petersen am 6 Okt. 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!

Akzeptierte Antwort

C B
C B am 6 Okt. 2021
Bearbeitet: C B am 6 Okt. 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,:)];

Weitere Antworten (1)

KSSV
KSSV am 6 Okt. 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 Kommentare
C B
C B am 6 Okt. 2021
I think he want to insert at 6th and 7th row
Frederike Petersen
Frederike Petersen am 6 Okt. 2021
thank you!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Sparse Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by