You are on page 1of 1

//mean from distribution table

function [m]= meanxf(x,f)

sumf = 0
sumfx = 0

for i=1:length(x)
sumf = sumf + f(i)
sumfx = sumfx + (f(i) * x(i))
end

m = sumfx/sumf
endfunction

You might also like