Write MATLAB functions
Write a script to ask the price to solve the above averaging problem:
function aver = myaver(x,n)
sizex = size(x);
sizen = size(n);
if sizex(2)~=sizen(2)
disp('数组维数不相同');
else
total = sum(n);
s = sum(x.*n);
ave = s/total
end
Regarding the final return value, if there is a semicolon behind, the output result is not displayed, otherwise it is displayed.