calculating average without using the mean function

조회 수: 5 (최근 30일)
NNADOZIE OPARA
NNADOZIE OPARA 2019년 2월 2일
편집: Stephen23 2019년 2월 2일
I am trying to calculating the average of a number set.
This is what i have done so far but it is not running smoothly
function [A] = average(X);
%this program calculates the average of a given number set
%enter the numbers either in a column or in a row; i.e use either a column
%vector or a row vector
[A] = Sum(X)/length(X)
%this will give the sum of the number set

답변 (1개)

Image Analyst
Image Analyst 2019년 2월 2일
Try using sum() instead of Sum(). MATLAB is case sensitive.
  댓글 수: 1
NNADOZIE OPARA
NNADOZIE OPARA 2019년 2월 2일
thanks...
MATLAB is indeed case sensitive.
i have tried it and the program ran

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by