Required elements: 1. A global average of E. Coli for all year for all the beach
ID: 3547585 • Letter: R
Question
Required elements:
1. A global average of E. Coli for all year for all the beaches and all the lakes sampled (one single average
for all).
2. The average levels of E. Coli for each beach for the entire year (one average per beach).
3. The average levels of E. Coli for each lake (all beaches) for the entire year (one average per lake).
4. A graph combining individual data for all beaches and for all months (graph from raw data
Lake Beach Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Ontario Cherry Beach 11.2 12.3 12.1 13.4 15.3 23.3 34.2 33.2 23.4 21.1 19.9 13.1 Ontario Sandbanks 11.1 9.2 13.1 14.1 17.1 34.3 23.3 44.4 32.1 12.5 23.3 23.3 Ontario Sunnyside Beach 41.1 31.1 42.2 43.3 53.3 65.5 66.6 75.3 43.3 32.2 21.1 43.3 Erie Port Colborne 21.2 22.3 32.1 33.4 35.3 53.3 54.2 43.2 23.4 21.9 39.9 3.1 Erie Port Dover 11.1 12.1 13.1 14.1 15.1 17.1 16.1 18.1 16.1 11.1 10.1 9.1 Erie Port Burwell 21.1 22.1 23.2 45.3 11.1 34.1 32.1 32.1 45.1 12.1 13.1 8.1 Erie Port Stanley 20.1 21.1 22.2 44.3 10.1 33.1 31.1 31.1 44.1 11.1 12.1 7.1 Huron Sauble Beach 19.1 20.1 21.2 43.3 9.1 32.1 30.1 30.1 43.1 10.1 11.1 6.1 Huron Kincardine 18.1 19.1 20.2 42.3 8.1 31.1 29.1 29.1 42.1 9.1 10.1 5.1 Huron Wasaga Beach 17.1 18.1 19.2 41.3 7.1 30.1 28.1 28.1 41.1 8.1 9.1 4.1 Huron Pinery 16.1 17.1 18.2 40.3 6.1 29.1 27.1 27.1 40.1 7.1 8.1 3.1Explanation / Answer
I have stored the data you have posted in a exel sheet named: 'chegg.xlsx'
For 1 to 7 questions--> questions code is below i have posted.
7) All the recommendations are stored in 'recommendation' cell. I have clearly explained using the comments in the code.
8)Fit is almost same for last 6 lakes.it can be seen from the first graph with title:'A graph combining individual data for all beaches and for all months'.
please give rating . :)
data=xlsread('chegg.xlsx');
global_average=sum(data(:))/(11*12); %% for global average we have to divide by total number of data.
%% there are 11 beaches and 12 months so total data is 11*12
average_per_beach=zeros(1,11); %% 'average_per_beach stores the averages for each beach.
%%As there are 11 beaches iam initialising the array to zeros.
for i=1:11
average_per_beach(i)=sum(data(i,:))/12;
end
average_per_lake=zeros(1,3);
for i=1:3;
if(i==1)
average_per_lake(i)= sum(data(1:3))/(3*12);
end
if(i==2)
average_per_lake(i)= sum(data(4:7))/(4*12);
end
if(i==3)
average_per_lake(i)= sum(data(8:11))/(4*12);
end
end
%%A graph combining individual data for all beaches and for all months
diff_col=jet(11);
figure
title('A graph combining individual data for all beaches and for all months');
for i=1:11
hold on
plot(data(i,:),'color',diff_col(i,:),'marker','o');
end
legend({'Cherry Beach','Sandbanks','Sunnyside Beach','Port Colborne','Port Dover','Port Burwell','Port Stanley','Sauble Beach','Kincardine','Wasaga Beach','Pinery'});
%% 5.A month-by month average of E. Coli for each lake
diff_col=jet(3);
month_avg_per_lake=zeros(3,12);
figure
title('month avg per lake');
for i=1:3
if(i==1)
month_avg_per_lake(i,:)=sum(data(1:3,:))/3;
end
if(i==2)
month_avg_per_lake(i,:)=sum(data(3:7,:))/4;
end
if(i==3)
month_avg_per_lake(i,:)=sum(data(8:11,:))/4;
end
hold on
plot(month_avg_per_lake(i,:),'color',diff_col(i,:));
end
legend({'Lake Ontario','Lake Erie','Lake Huron'});
%%6. A month-by month average of E. Coli for all lakes with a graph
diff_col=jet(12);
month_by_month_avg=zeros(1,12);
figure
for i=1:12
month_by_month_avg(i)=sum(data(:,i))/12;
end
x=1:12;
stem(x,month_by_month_avg); %%% numbers in x-axis represent month 1-jan,2-feb etc..
%legend({'Jan','Feb','March','April','May','June','July','Aug','Sept','Oct','Nov','Dec'});
title('month by month avg');
%%Calculating recommendations
recommendation=cell(11,12); %% recommendation call stores the strings 'close beach' or 'open beach' .
%%each element of the call represent the
%%correspoding month and lake
%%recommendation{i,j} represents lake ontario
%%and january month
for i=1:11
for j=1:12
if(data(i,j)>=50)
recommendation{i,j}='close beach';
else
recommendation{i,j}='open beach';
end
end
end
%% fit for lakes
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.