フィルターのクリア

how to find average values of answers

2 ビュー (過去 30 日間)
Ali Noori
Ali Noori 2015 年 8 月 21 日
コメント済み: Ali Noori 2015 年 8 月 21 日
%For example, if you write this code for a=1:5; b = 2*a + 1 end the answers are >> b =
3
b =
5
b =
7
b =
9
b =
11
I want to calculate the mean values for these answers
b average = (3 + 5+ 7+ 9+11) / 5 = 7

採用された回答

Purushottama Rao
Purushottama Rao 2015 年 8 月 21 日
b=zeros(1,5)
for a=1:5
b(a)=2*a+1;
end
k=mean(b);
  2 件のコメント
Purushottama Rao
Purushottama Rao 2015 年 8 月 21 日
If you want to diplay every time avg, move mean commnd inside the for loop
Ali Noori
Ali Noori 2015 年 8 月 21 日
ok thanks, but ur code will give vector answer for each value of b

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by