필터 지우기
필터 지우기

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

Community Treasure Hunt

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

Start Hunting!

Translated by