The average of the numbers in the vector “v” is calculated by summing all the individual values, and then dividing the sum by the number of numbers in “v”.
- A) Create program code for function file “average” which takes as the input vector “v” and uses a for-loop to calculate the average of all the numbers in “v”. Hint: To determine the number of numbers (n) in the vector “v” you can use n = length (v) . Your code must begin with
function x = average (v)
- B) b) Let T be a table with n = 100 rows and m = 100 columns. Write a program that, using pre-loop and if-testing, counts the number of columns in T that have an average value of less than 10.
HINT: You retrieve a copy of column number k in table T by typing t = T (:, k);
Create program code for function file “average” which takes as the input vector “v” and uses a for-loop to calculate the average of all the numbers in “v”. Hint: