Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
data=dlmread('US_energy_by_sector.csv',',',2,0);
figure(1)
plot(data(:,1),data(:,3),data(:,1),data(:,9))
title('US Energy Consumption by year')
xlabel('Year')
ylabel('Total Energy Consumed (Trillion BTU)')
legend('Residential Sector','Transportation Sector','Location','northwest')
print('./figures/figure1.png')
X=cumsum(data(:,3));
Y=cumsum(data(:,9));
Z=X/1000000;
Q=Y/1000000;
figure(2)
plot(data(:,1),Z,data(:,1),Q)
title('Cumulative US Energy Consumption by Year')
xlabel('Year')
ylabel('Cumulative Energy Consumed (Quintillion BTU)')
legend('Residential Sector','Transportation Sector','Location','northwest')
print('./figures/figure2.png')