Average vector of an array

2 ビュー (過去 30 日間)
Karim ElShorbagi
Karim ElShorbagi 2020 年 11 月 22 日
コメント済み: Karim ElShorbagi 2020 年 11 月 22 日
So if I have a 6x2 array, lets say:
[0 0 0 0 0 0]' and [2 2 2 2 2 2]'
how do I use matlab to find an average vector of these vectors so that it returns for example [1 1 1 1 1 1]'?

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 11 月 22 日
You can specify the dimension in mean() function. For example
x = [0 2;
0 2;
0 2;
0 2;
0 2;
0 2];
y = mean(x, 2)
  1 件のコメント
Karim ElShorbagi
Karim ElShorbagi 2020 年 11 月 22 日
Thanks!

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


dpb
dpb 2020 年 11 月 22 日

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by