calculating average without using the mean function

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

Antworten (1)

Image Analyst
Image Analyst am 2 Feb. 2019

1 Stimme

Try using sum() instead of Sum(). MATLAB is case sensitive.

1 Kommentar

thanks...
MATLAB is indeed case sensitive.
i have tried it and the program ran

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 2 Feb. 2019

Bearbeitet:

am 2 Feb. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by