From e7d9b3391fd1b75e398f6d8d0ffa0708bd945c0d Mon Sep 17 00:00:00 2001 From: Braisted Date: Tue, 12 Sep 2017 12:02:09 -0400 Subject: [PATCH 01/12] Energy Plots --- US_energy_by_sector_code.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/US_energy_by_sector_code.m b/US_energy_by_sector_code.m index 2fb6834..5578920 100644 --- a/US_energy_by_sector_code.m +++ b/US_energy_by_sector_code.m @@ -11,9 +11,9 @@ legend('Residential','Transportation','Location','northwest') title('US Energy Consumption from 1949 to 2016') -rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy +rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy %consumption in quintillions -transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational +transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational %energy consumption in quintillions figure(2) plot(data(:,1),rescum,data(:,1),transcum) From bd8feb6665095cb54024452e5d6d857bf601d551 Mon Sep 17 00:00:00 2001 From: Braisted Date: Tue, 12 Sep 2017 12:05:42 -0400 Subject: [PATCH 02/12] Problem 4 --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index e354bda..ef682fc 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,30 @@ # Answer to Homework Question I hope to learn how to perform MATLAB functions more easily. + +#Problem 4 +```MATLAB +data=dlmread('US_energy_by_sector.csv',',',2,0); +figure(1) +plot(data(:,1),data(:,3),data(:,1),data(:,9)); +set(0, 'defaultAxesFontSize', 16) +set(0,'defaultTextFontSize',14) +set(0,'defaultLineLineWidth',3) +set(gcf, 'Position', [200, 200, 1000, 800]) +xlabel('Time (years)') +ylabel('Total Energy Consumed (trillions of BTUs)') +legend('Residential','Transportation','Location','northwest') +title('US Energy Consumption from 1949 to 2016') + + +rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy +%consumption in quintillions +transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational +%energy consumption in quintillions +figure(2) +plot(data(:,1),rescum,data(:,1),transcum) +set(gcf, 'Position', [500, 200, 1000, 800]) +xlabel('Time (years)') +ylabel('Total Energy Consumed (quintillions of BTUs)') +legend('Residential','Transportation','Location','northwest') +title('Cumulative US Energy Consumption from 1949 to 2016') From 5b542df849ac0eb1e45e6f392e90fda1ae0b6530 Mon Sep 17 00:00:00 2001 From: Braisted Date: Tue, 12 Sep 2017 12:07:21 -0400 Subject: [PATCH 03/12] HW1 --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index ef682fc..9673023 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,17 @@ # Answer to Homework Question I hope to learn how to perform MATLAB functions more easily. +#A_66 +```MATLAB +A_66=zeros(6:6); +for i=1:6; + j=1:6; + A_66(i,j)=i*j; +end +Average = mean(A_66(:)) +Standard_Deviation = std(A_66(:)) + + #Problem 4 ```MATLAB data=dlmread('US_energy_by_sector.csv',',',2,0); From 55695ec71bf96f16a229bea59503564f170bdeb8 Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Tue, 12 Sep 2017 12:08:47 -0400 Subject: [PATCH 04/12] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9673023..15971b6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ for i=1:6; end Average = mean(A_66(:)) Standard_Deviation = std(A_66(:)) - +``` #Problem 4 ```MATLAB @@ -35,6 +35,7 @@ transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational %energy consumption in quintillions figure(2) plot(data(:,1),rescum,data(:,1),transcum) +``` set(gcf, 'Position', [500, 200, 1000, 800]) xlabel('Time (years)') ylabel('Total Energy Consumed (quintillions of BTUs)') From 2edac34c4c87e87936309e8199240bd66822935f Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Tue, 12 Sep 2017 12:10:10 -0400 Subject: [PATCH 05/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 15971b6..e94b2a9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Answer to Homework Question I hope to learn how to perform MATLAB functions more easily. -#A_66 +#Problem 2 ```MATLAB A_66=zeros(6:6); for i=1:6; From 1e1cfc037dc4cef62858fb4e8744977a06fb9a6b Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Tue, 12 Sep 2017 12:10:57 -0400 Subject: [PATCH 06/12] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e94b2a9..f6a4e39 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational %energy consumption in quintillions figure(2) plot(data(:,1),rescum,data(:,1),transcum) -``` + set(gcf, 'Position', [500, 200, 1000, 800]) xlabel('Time (years)') ylabel('Total Energy Consumed (quintillions of BTUs)') legend('Residential','Transportation','Location','northwest') title('Cumulative US Energy Consumption from 1949 to 2016') +``` From a080c18f331d17307b107916dc6ec229f09ee6cf Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:06:28 -0400 Subject: [PATCH 07/12] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f6a4e39..06542e9 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,4 @@ ylabel('Total Energy Consumed (quintillions of BTUs)') legend('Residential','Transportation','Location','northwest') title('Cumulative US Energy Consumption from 1949 to 2016') ``` +#Problem 5 (Velocity and Acceleration) From 69d2af16b51f469985e9b334c639ae7ef88be0c1 Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:17:35 -0400 Subject: [PATCH 08/12] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 06542e9..109ec12 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,11 @@ for i=1:6; j=1:6; A_66(i,j)=i*j; end -Average = mean(A_66(:)) -Standard_Deviation = std(A_66(:)) +fprintf('mean of A_66 = %1.2f\nstdev of A_66 = %1.2f\n',mean(A_66(:)),std(A_66(:))) ``` +Outputs: +mean of A_66 = 12.25 +stdev of A_66 = 9.07 #Problem 4 ```MATLAB From d70fa3caac58652e067703aac2b40243d03a34a1 Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:17:58 -0400 Subject: [PATCH 09/12] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 109ec12..ab84483 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ end fprintf('mean of A_66 = %1.2f\nstdev of A_66 = %1.2f\n',mean(A_66(:)),std(A_66(:))) ``` Outputs: + mean of A_66 = 12.25 + stdev of A_66 = 9.07 #Problem 4 From c6d4316fcb8a34bc0032731d15a5c7e27b6f1efd Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:19:12 -0400 Subject: [PATCH 10/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab84483..2304ff9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Answer to Homework Question I hope to learn how to perform MATLAB functions more easily. -#Problem 2 +#Problem 3 ```MATLAB A_66=zeros(6:6); for i=1:6; From 5b1db52b2958be0a38a9bd3782ae1200b1b741a0 Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:33:41 -0400 Subject: [PATCH 11/12] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2304ff9..b3efe5c 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ stdev of A_66 = 9.07 #Problem 4 ```MATLAB data=dlmread('US_energy_by_sector.csv',',',2,0); -figure(1) +h=figure(); plot(data(:,1),data(:,3),data(:,1),data(:,9)); set(0, 'defaultAxesFontSize', 16) set(0,'defaultTextFontSize',14) @@ -31,19 +31,19 @@ xlabel('Time (years)') ylabel('Total Energy Consumed (trillions of BTUs)') legend('Residential','Transportation','Location','northwest') title('US Energy Consumption from 1949 to 2016') +saveas(h,'figure_01.png') - -rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy +rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy %consumption in quintillions -transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational +transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational %energy consumption in quintillions -figure(2) +h=figure(); plot(data(:,1),rescum,data(:,1),transcum) - set(gcf, 'Position', [500, 200, 1000, 800]) xlabel('Time (years)') ylabel('Total Energy Consumed (quintillions of BTUs)') legend('Residential','Transportation','Location','northwest') title('Cumulative US Energy Consumption from 1949 to 2016') +saveas(h,'figure_02.png') ``` #Problem 5 (Velocity and Acceleration) From 91d61e3e4b17400ee1c842feddcb5f3ad25e1994 Mon Sep 17 00:00:00 2001 From: Travis E Braisted Date: Wed, 13 Sep 2017 18:35:30 -0400 Subject: [PATCH 12/12] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3efe5c..7532f66 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ stdev of A_66 = 9.07 data=dlmread('US_energy_by_sector.csv',',',2,0); h=figure(); plot(data(:,1),data(:,3),data(:,1),data(:,9)); +%plotting residential energy consumption and transportational energy +%consumption from 1949 to 2016 in trillions of BTUs set(0, 'defaultAxesFontSize', 16) set(0,'defaultTextFontSize',14) set(0,'defaultLineLineWidth',3) @@ -34,9 +36,9 @@ title('US Energy Consumption from 1949 to 2016') saveas(h,'figure_01.png') rescum=cumsum(data(:,3))./1000000;%cumulative sum of residential energy -%consumption in quintillions +%consumption in quintillions of BTUs transcum=cumsum(data(:,9))./1000000;%cumulative sum of transportational -%energy consumption in quintillions +%energy consumption in quintillions of BTUs h=figure(); plot(data(:,1),rescum,data(:,1),transcum) set(gcf, 'Position', [500, 200, 1000, 800])