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

United States net electric power generation for several fuels are shown in the t

ID: 2292785 • Letter: U

Question

United States net electric power generation for several fuels are shown in the table below Net Electric Power Generation (1000 Megawatt Hours) Fuel Year 2011 Year 2012 Year 2013 Year 2014 Year 2015 Coal Petroleum Liquids Petroleum Coke Natural Gas Other Gas Nuclear Hydroelectric Conventional Renewable Sources Excluding Hydroelectric Wind Solar Thermal and Photovoltaic Wood and Wood-Derived Fuels Other Biomass 1,301,107 ,146,480 9,892 5,664 504,958 11,688 9,428 414,843 29 415,298 291,413 21,933 17,140 216 2,023 1,417 1,137 604 1,188,4521,173,073 10,696 9,147 501,427501,414 112 406,114 419,871 243,040 238,185 34,496 27,671 1,218 3,050 1,441 1,116 622 998,385 10,386 8,278 617,817 199 416,680 229,640 37,485 30,412 1,494 3,018 1,473 1,089 558 9,446 9,522 798 394,823 252,936 28,017 22,926 639 1,836 1,472 1,143 603 32,417 26,436 943 2,534 1,499 1,005 615 Other Energy Sources Write a MATLAB script to accomplish the following requirements. Include comments (% This is a comment ) in your code 1. This data is stored in a cell named Electric. Use size() and assign the number of rows and number of colums in Electric to the variables ElectricRows and ElectricColumns, respectively 2. Create a 14 x 1 cell array named power2011cell containing the power generated for Year 2011 3. Create a 14 x 1 vector (double) named power2011vector containing the power generated for Year 2011 4. Create a bar graph like the one shown below by graphing Year 2011 and Year 2015 assign values to variables named y2011 and y2015 assign axes handle to the current axes (hint: get current axes) use axes handle to assign values to the X Tick Lables, Y Grid, X Tick Lable Rotation (30 degrees), and Y Label (Hint String) include a legend

Explanation / Answer

load electric_power % This loads the data into workspace
whos % use whos to see variable in your workspace
% Include comes to describe your methods
%
[M,N]=size(electric_power); % this will find the size of the cell array loaded
ElectricRows=M; % this will store the number of rows into variable ElectricRows
ElectricColumns=N; % this will store the number of Columns into variable ElectricColumns
%
power2011cell={1301107;11688;9428;414843;29;415298;291413;21933;17140;216;2023;1417;1137;604};
power2011vector=[1301107;11688;9428;414843;29;415298;291413;21933;17140;216;2023;1417;1137;604];
power2015cell={998385;10386;8278;617817;199;416680;229640;37485;30412;1494;3018;1473;1089;558};
power2015vector=[998385;10386;8278;617817;199;416680;229640;37485;30412;1494;3018;1473;1089;558];
y2011=power2011vector;
y2015=power2015vector;
bar([y2011 y2015]); % this will generate a bar plot
% we can set the properties o axis using 'gca (Get Current Axis)' property
ax=gca;
ax.Ygrid='on'; % enable the Y grid
ax.YLabel='Power Generation'; % writes the Y label
ax.XTickLabelRotation=30; % rotates the XTick labels with 30 degrees

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote