Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose foxes is a MATLAB array with 394 rows and 30 columns representing the nu

ID: 3834404 • Letter: S

Question

Suppose foxes is a MATLAB array with 394 rows and 30 columns representing the number of animals born in each of the 394 US National Parks in a 30 year span (1976-2005). Define MATLAB variables for each of the following: a) The average number of foxes born in each park over the time frame of the data. b) The total number of foxes born in each park. c) The difference between the overall largest and the overall smallest number of foxes born each year, across all parks (the range). d) The fraction of the foxes born before 1985. e) The number of foxes born in Park #14.

Explanation / Answer

Given, foxes an array of size 394 rows, and 30 cols where
rows represent US National Parks, and
cols represent years span.

a. The average number of foxes born in each park over the time frame of the data.
[rows, cols] = size(foxes);
average = sum(sum(foxes)) / rows;

b. The total number of foxes born in each park.
numOfFoxesInEachPark = sum(foxes, 2);