フィルターのクリア

Add two rows in a matrix with new datas

1 回表示 (過去 30 日間)
Frederike Petersen
Frederike Petersen 2021 年 10 月 6 日
コメント済み: Frederike Petersen 2021 年 10 月 6 日
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!

採用された回答

C B
C B 2021 年 10 月 6 日
編集済み: C B 2021 年 10 月 6 日
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,:)];
  1 件のコメント
Frederike Petersen
Frederike Petersen 2021 年 10 月 6 日
Thanks for your response!! :)

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2021 年 10 月 6 日
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 件のコメント
C B
C B 2021 年 10 月 6 日
I think he want to insert at 6th and 7th row
Frederike Petersen
Frederike Petersen 2021 年 10 月 6 日
thank you!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSparse Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by