Let's say I have 200 data points $(x,y)$. I know the step size for the input $x$ is $h$. To find the approximated average function value $A$ of some unknown function $ x \mapsto y$, I believe I could use a trapezoid rule like:
I = 0;
for k = 1:199
I = I + h * ( y(k) + y(k+1) ) * (1/2);
end
A = 1/(x(end) - x(begin)) * I;
return A;
But I was just thinking, can't I just take the mean of the $y$-vector, to get the same result?