필터 지우기
필터 지우기

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개)

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 CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by