Question
MATLAB PLEASE HELP!!! This is Assign 05 in MatLab: clc, clear all %*****CONSTANT***** %*****INPUT***** load('lake_powell.txt'); years = (2013:1:2016); fprintf(' Lake Powell Water Levels (in feet)
MATLAB PLEASE HELP!!!
This is Assign 05 in MatLab:
clc, clear all %*****CONSTANT*****
%*****INPUT***** load('lake_powell.txt');
years = (2013:1:2016); fprintf(' Lake Powell Water Levels (in feet) ');
%print title and year column headings.
for i=1:length(years) fprintf('%5d\t',years(i)); end
%print contents of lake_powell
for i=1:size(lake_powell,1) fprintf(' '); for j=1:size(lake_powell,2) fprintf('%7.2f\t',lake_powell(i,j)); end end
fprintf(' '); fprintf(' ');
%print and determine the average elevation of water level for each year and overall average fprintf('PART B: Determine average elevation of water level for each year and overall average'); mean_each_year = mean(lake_powell,1); fprintf(' Average for Each Year (in feet) ');
for i=1:length(years) fprintf(' %d\t',years(i)); end fprintf(' '); for i=1:length(mean_each_year) fprintf('%4.2f\t',mean_each_year(i)); end overall_mean = mean(mean_each_year); fprintf(' Overall average : %.2f feet',overall_mean); disp (' ') disp (' ') %print and determine how many months of each year > overall average fprintf('PART C: Determine how many months of each year > overall average'); number_of_months = zeros(1,size(lake_powell,2)); for i=1:size(lake_powell,2) number_of_months(i) = length(find(lake_powell(:,i)>overall_mean)); end for i=1:length(years) fprintf(' During %d the lake was above average for %d months',years(i),number_of_months(i)); end fprintf(' '); fprintf(' '); %print and determine and print average elevation of the water for each month fprintf('PART D: Determine and print average elevation of the water for each month'); mean_each_month = mean(lake_powell,2); fprintf(' Average elevation (in feet) of water for each month Month\t Elevation'); for i=1:length(mean_each_month) fprintf(' %d\t %.2f',i,mean_each_month(i)); end fprintf(' '); %plot the water level values in lake_powell with labels on the x- and y-axis date = 2013:1/12:2017-1/12; plot(date,lake_powell(:)); title('Water Level Values in Lake Powell'); xlabel('Year') ylabel('Water level, ft')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started