matlab function library [] code example Example: matlab function function ave = average(x) ave = sum(x(:))/numel(x); end