Using matlab and the information given below plot the statistics so taht the fin
ID: 3863485 • Letter: U
Question
Using matlab and the information given below plot the statistics so taht the final figure looks like the following figure below.
You are provided with data for renewable energy statistics in EU for the period of 2004 2014. File Data dat contains the following information (with no text in it): 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 362.8 348.0 351.3 347.9 364.1 366.6 408.0 340.4 366.6 403.1 406.5 Hydropower TWh) 58.9 70.5 82.3 104.4 119.5 133.1 149.4 179.7 206.0 236.8 253.2 Wind turbines TWh) 7.4 14.0 22.5 45.3 67.4 80.9 92.3 Solar TWh) 0.7 1.5 2.5 3.8 60.1 69.9 79.1 87.6 97.5 107.6 123.8 132.7 148.5 57.2 166.8 Biomass & renewable waste (TWh) Geothermal (TWh) 5.5 5.4 5.6 5.8 5.7 5.5 5.6 5.9 5.8 5.9 6.2 Electricity from renewables of 19 19.7 21.7 23.5 25.4 27.5 14.4 14.9 15.4 16.1 consumption) 17 You need to plot the statistics so that the final figure looks like the following (you may use different colors Hint: you should use stacked' style for the bar plot To show grid in only one direction read about set(gca,...) commandExplanation / Answer
hydro= [362.8,348.0,351.3,347.9,364.1,366.6,408.0,340.4,366.6,403.1,406.5]';
wind= [58.9,70.5,82.3,104.4,119.5,133.1,149.4,179.7,206.0,236.8,253.2]';
solar=[0.7,1.5,2.5,3.8,7.4,14.0,22.5,45.3,67.4,80.9,92.3]';
bio=[60.1,69.6,79.1,87.6,97.5,107.6,123.8,132.7,148.5,157.2,166.8]';
geo=[5.5,5.4,5.6,5.8,5.7,5.5,5.6,5.9,5.8,5.9,6.2]';
renew=[14.4,14.9,15.4,16.1,17,19,19.7,21.7,23.5,25.4,27.5]';
total=hydro+wind+solar+bio+geo+renew;
% Create a stacked bar chart using the bar function
figure
bar(1:14,[hydro wind solar bio geo renew],0.5,'stack')
% Adjust the axis limits
axis([2003 2015 0 1500])
set(gca,'XTick',1:14)
% Add title and axis labels
title('Renewable Energy Statistics')
xlabel('Year')
ylabel('Electricity Generated (TwH)')
% Add title and axis labels
Legend('Hydropower(TWh)','Wind turbines(TWh)','Solar(TWh)','Biomass & Renewable -waste(TWh)','Geothermal(TWh)','Electricity from renewable(TWh)')
*******************EXPLANATION..NOT CODE***********8
First the variables are defined in various columns,They are then displayed Using bar function ,the axes are set,later the titles for each is defined using Legend funtcion
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.