finding mean in row wise

3 ビュー (過去 30 日間)
Pat
Pat 2012 年 11 月 19 日
I have values as
D=rand(3,7)
D =
0.5407 0.3181 0.6456 0.5447 0.7210 0.2187 0.0636
0.8699 0.1192 0.4795 0.6473 0.5225 0.1058 0.4046
0.2648 0.9398 0.6393 0.5439 0.9937 0.1097 0.4484
i want to find mean of 3column,next 2 ,next 2
for example
3columns
0.5407 0.3181 0.6456
0.8699 0.1192 0.4795
0.2648 0.9398 0.6393
now want to find mean in row wise ,so i will get
mean1 mean2 mean3
same way i have to do for others also
please help

採用された回答

Pedro Villena
Pedro Villena 2012 年 11 月 19 日
編集済み: Pedro Villena 2012 年 11 月 21 日
mean1 = mean(D(:,1:3),2),
mean2 = mean(D(:,4:5),2),
mean3 = mean(D(:,6:7),2),
or
D1 = [37.8518 22.2652 45.1886 38.1301 50.4733 15.3074 4.4514;
60.8959 8.3450 33.5624 45.3118 36.5747 7.4059 28.3206;
18.5345 65.7881 44.7522 38.0720 69.5593 7.6788 31.3861];
d = sort(D1,2);
meanData = mean(d(:,1:(end+1)/2:end),2);
meanData =
4.4514 15.3074 22.2652
28.3206 7.4059 8.3450
31.3861 7.6788 65.7881
  1 件のコメント
Pat
Pat 2012 年 11 月 19 日
編集済み: Pat 2012 年 11 月 19 日
ok thanks Pedro another question suppose my data ia
D1 =
37.8518 22.2652 45.1886 38.1301 50.4733 15.3074 4.4514
60.8959 8.3450 33.5624 45.3118 36.5747 7.4059 28.3206
18.5345 65.7881 44.7522 38.0720 69.5593 7.6788 31.3861
in this i have to take first row,i have to choose 3 values,min max and middle value and find the mean with its nearesr values
4.4514 15.3074 22.2652
28.3206 7.4059 8.3450
31.3861 7.6788 65.7881
for this i have to find mean in row wise ,
sane for next two ,and so on till end

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 11 月 19 日
mean(D(:,1:3),2)

カテゴリ

Help Center および File ExchangeBar Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by