In: Computer Science
A) Suppose owls is a MATLAB array with 251 rows and 51 columns representing the number of owls counted in the 251 counties in Texas had over the years 1960-2010. Write code to define a MATLAB variable to find the median number of owls counted in each county.
B) Suppose cattle is a MATLAB array with 251 rows and 51 columns representing the number of cattle in the 251 counties in Texas had over the years 1950-2000. Write code to define a MATLAB variable that contains the median number of cattle counted each year.
C) Suppose the Texas Department of Public Health is tracking the number of tuberculosis deaths in an array (TBDeaths, 30 by 48), representing the number of new tuberculosis related deaths in the 30 least populous counties (in order low to high) in Texas over the years 1960-2017. Write code to define a MATLAB variable that contains the overall minimum number of TB deaths cases in these counties during the recording period.
D) Suppose the Texas Department of Motor Vehicles is tracking the number of car, truck and motorcycle (respectively) crashes in Texas over the years 2000 to 2019 in an array TXCrash (3 x 20).
Write code to define a MATLAB variable that contains the number of
truck crashes for the year 2019.
Code
owls = zeros(251,51);
owls = randi([0,100],size(owls)); %Choose random number of owls in
251 countries ranging from 0 to 100.
i=1;
while(i<52)
owls_median(i,1) = median(owls(i,:));
i=i+1;
end
cattle = zeros(251,51);
cattle = randi([0,100],size(cattle));
cattle_median = median(cattle);
TBDeaths = zeros(30,48);
TBDeaths = randi([0,100],size(TBDeaths));
TBDeaths_LowtoHigh = sort(TBDeaths);
i=1;
while(i<31)
TBDeaths_minimum(i,1) = min(TBDeaths_LowtoHigh(i,:));
i=i+1;
end
TXCrash = zeros(3,20);
TXCrash = randi([0,100],size(TXCrash));
TXCrash_truck_2019 = (TXCrash(2,end));
===============================================
Results