Write MATLAB function to compute the of average of a vector
Write MATLAB function to compute the of average of a vector x and plot the histogram of x. the function should accept the vector x as input and return the average of x output.
Solution
function average = averageOfVector(Vector)
     numberOfElements = numel(Vector);
     sumOfElements = 0;
     for i = 1:numberOfElements
         sumOfElements = sumOfElements + Vector(i);
     end
     average = sumOfElements/numberOfElements;
 end
Vector = input(\"Enter vector : \");
 a = averageOfVector(Vector);
 fprintf(\"Average of given vector is : %f \ \",a);

