HW4 soln

EGR 326
HW 4 National Economy Model
Feb 2017
NotesForSelf-Grading
1) You should not have the same Matlab script that I have, since as with writing
essays, everyone will write computer code differently.
a. You also should not have the exact same graphs with the same titles, axis
labels, and lines/colors etc. that I have.
2) Do not feel that you should have the same extent of output graphs, and you
certainly will not have the same discussion or description of the graphs that I
have.
3) If your Matlab script is significantly different from mine, in that you have the
equation(s) incorrect or did not include all the variables or coefficient data, then
your script will need to be ‘corrected,’ but otherwise, I expect that everyone’s
implementation will differ to some degree.
4) If your analysis of the behavior of the economy is substantively different from my
analysis then you may want to ‘correct’ your own analysis. But if you simply
looked at different elements of the behavior or comment on different patterns,
then yours is as correct as mine.
EGR 326
HW 4 National Economy Model
Feb 2017
MatlabScriptfortheNationalEconomyModel
% HW5.m
% Author: J Cardell
% Date: Feb 2017
% EGR 326 Homework 5: National economy
% parameter values and initial conditions. Note that Matlab does not
% accept an index of '0' so we start at year '1'
a = 0.9;
% marginal propensity to consume, a < 1
b = 0.5;
% constant of adjustment, b > 0
y(1) = 1;
% initial conditions
y(2) = 1.1;
% plot national income for 30 years, using values provided in problem
% statement
for k = 1:28
y(k+2) = a*(1+b)*y(k+1) - a*b*y(k) + 1;
end
t = [1:1:30];
plot (t, y, 'r')
title ('National Income Over 30 Years')
ylabel ('National Income, $T')
xlabel ('Year')
axis ([0 30 0 10])
% Plot natural response - with no input
for k = 1:28
y(k+2) = a*(1+b)*y(k+1) - a*b*y(k) + 0;
end
t = [1:1:30];
plot (t, y, 'r')
title ('National Income Over 30 Years with no input')
ylabel ('National Income, $T')
xlabel ('Year')
axis ([0 30 0 10])
% Sensitivity to initial conditions
a = 0.9;
% marginal propensity to consume, a < 1
b = 0.5;
% constant of adjustment, b > 0
% plot national income for 30 years, using values provided in problem
% statement
y1a(1) = 1;
% initial conditions
y1a(2) = 1.1;
for k = 1:28
y1a(k+2) = a*(1+b)*y1a(k+1) - a*b*y1a(k) + 1;
end
y1b(1) = 1;
% initial conditions
y1b(2) = 0;
for k = 1:28
y1b(k+2) = a*(1+b)*y1b(k+1) - a*b*y1b(k) + 1;
end
y1c(1) = 0;
% initial conditions
y1c(2) = 1;
for k = 1:28
y1c(k+2) = a*(1+b)*y1c(k+1) - a*b*y1c(k) + 1;
end
y1d(1) = 2;
% initial conditions
y1d(2) = 3;
EGR 326
HW 4 National Economy Model
Feb 2017
for k = 1:28
y1d(k+2) = a*(1+b)*y1d(k+1) - a*b*y1d(k) + 1;
end
y1e(1) = 5;
% initial conditions
y1e(2) = 7;
for k = 1:28
y1e(k+2) = a*(1+b)*y1e(k+1) - a*b*y1e(k) + 1;
end
t = [1:1:30];
plot (t, y1a, 'r-', t, y1b, 'b:', t, y1c, 'g', t, y1d, 'c--', t, y1e,
'm')
title ('National Income Over 30 Years: Sensitivity to Initial
Conditions')
ylabel ('National Income, $T')
xlabel ('Year')
% Sensitivity to 'a' - the marginal propensity to consume; a < 1
b = 0.5;
% constant of adjustment, b > 0
y2a(1) = 2;
% initial conditions
y2a(2) = 3;
y2b(1) = 2;
% initial conditions
y2b(2) = 3;
y2c(1) = 2;
% initial conditions
y2c(2) = 3;
y2d(1) = 2;
% initial conditions
y2d(2) = 3;
y2e(1) = 2;
% initial conditions
y2e(2) = 3;
% plot national income for 30 years, using values provided in problem
% statement
a = 0.1;
% marginal propensity to consume, a < 1
for k = 1:28
y2a(k+2) = a*(1+b)*y2a(k+1) - a*b*y2a(k) + 1;
end
a = 0.25;
% marginal propensity to consume, a < 1
for k = 1:28
y2b(k+2) = a*(1+b)*y2b(k+1) - a*b*y2b(k) + 1;
end
a = 0.5;
% marginal propensity to consume, a < 1
for k = 1:28
y2c(k+2) = a*(1+b)*y2c(k+1) - a*b*y2c(k) + 1;
end
a = 0.8;
% marginal propensity to consume, a < 1
for k = 1:28
y2d(k+2) = a*(1+b)*y2d(k+1) - a*b*y2d(k) + 1;
end
a = 0.98;
% marginal propensity to consume, a < 1
for k = 1:28
y2e(k+2) = a*(1+b)*y2e(k+1) - a*b*y2e(k) + 1;
end
t = [1:1:30];
plot (t, y2a, 'r-', t, y2b, 'b:', t, y2c, 'g', t, y2d, 'c--')
title ('National Income Over 30 Years: Sensitivity to a')
ylabel ('National Income, $T')
xlabel ('Year')
pause
hold on
EGR 326
HW 4 National Economy Model
Feb 2017
plot (t, y2e, 'm')
title ('National Income Over 30 Years: Sensitivity to a')
ylabel ('National Income, $T')
xlabel ('Year')
% Sensitivity to 'b' - the constant of adjustment that describes how
% the rate of private investment is affected by changes in consumer
% spending;
% b > 0
clf
clear
a = 0.9;
% marginal propensity to consume, a < 1
y3a(1) = 1;
% initial conditions
y3a(2) = 1.1;
y3b(1) = 1;
% initial conditions
y3b(2) = 1.1;
y3c(1) = 1;
% initial conditions
y3c(2) = 1.1;
y3d(1) = 1;
% initial conditions
y3d(2) = 1.1;
y3e(1) = 1;
% initial conditions
y3e(2) = 1.1;
% plot national income for 30 years, using values provided in problem
% statement
b = 0.5;
% constant of adjustment, b > 0
for k = 1:28
y3a(k+2) = a*(1+b)*y3a(k+1) - a*b*y3a(k) + 1;
end
b = 0.75;
% constant of adjustment, b > 0
for k = 1:28
y3b(k+2) = a*(1+b)*y3b(k+1) - a*b*y3b(k) + 1;
end
b = 0.9;
% constant of adjustment, b > 0
for k = 1:28
y3c(k+2) = a*(1+b)*y3c(k+1) - a*b*y3c(k) + 1;
end
b = 1.2;
% constant of adjustment, b > 0
for k = 1:28
y3d(k+2) = a*(1+b)*y3d(k+1) - a*b*y3d(k) + 1;
end
b = 1.8;
% constant of adjustment, b > 0
for k = 1:28
y3e(k+2) = a*(1+b)*y3e(k+1) - a*b*y3e(k) + 1;
end
t = [1:1:30];
plot (t, y3a, 'r-', t, y3b, 'b:', t, y3c, 'g', t, y3d, 'c--')
title ('National Income Over 30 Years: Sensitivity to b')
ylabel ('National Income, $T')
xlabel ('Year')
hold on
pause
plot (t, y3e, 'm')
title ('National Income Over 30 Years: Sensitivity to b')
ylabel ('National Income, $T')
xlabel ('Year')
EGR 326
HW 4 National Economy Model
Feb 2017
ResultsfromrunningHW5.mscript
Discussion:BaseCase
This base case plot shows the economy growing, with the general form (1-e-at) (as with
an RC or RL circuit), and reaching a steady-state maximum value of national income of
$10 trillion after 22 years, or so. The national income reaches ~63% of its final value (i.e.,
one time constant) after 7 years or so.
EGR 326
HW 4 National Economy Model
Feb 2017
Discussion:SensitivitytoInitialConditions
The base case is plotted here again, as the red line. Changing the initial conditions is seen
to have minor effect in most cases. However, in the top, magenta line with initial
conditions y(1), Y(2) = 5 and 7, the impact of having started at higher initial conditions is
seen to significantly decrease the time required for the national income to reach its final
steady-state (though the time constant itself is unchanged). Also, for the blue dashed line,
with initial conditions y(1), Y(2) = 1 and 0, the national income is seen to drop (as
defined by the initial condition) in year 2, and then recover and follow the same pattern
as traced by the other cases.
In all cases, the final steady state value for the national income is the same, $10 trillion,
and the time constant, as a ‘characteristic value’ or eigenvalue of the system, has the
same functional value with respect to ‘a’ and ‘b,’ yet changes numerically as these
parameter values change.
EGR 326
HW 4 National Economy Model
Feb 2017
Top graph repeated,
with the magenta line,
for ‘a’ = 0.98 included.
Discussion:Sensitivityto‘a’-themarginalpropensitytoconsume
As seen in the plots above, the parameter ‘a’ can have a significant impact on the
behavior of this system – on the national income. When ‘a’ is 0.1 and 0.5, the bottom
three plots, the national income is seen to collapse, rather than grow – if people to not
consume, the economy will not grow (according to this model). As ‘a’ approaches the
value of 1 however, the economy is seen to grow, settling at a higher final steady state the
larger ‘a’ is. (it might also be interesting to see what happens if ‘a’ > 1)
EGR 326
HW 4 National Economy Model
Feb 2017
Top graph repeated,
with the magenta line,
for ‘b’ = 1.8 included.
Discussion:Sensitivityto‘b’–constantofadjustment
With ‘b’ equal to 0.5 and 0.75, the behavior of the national income does not include
oscillations (the red and blue dashed lines). However, these plots show that ‘b’ has a
significant effect on the possibility of the national income oscillating! This might be
similar to what we actually experience, with the economy going through boom and bust
cycles, as unemployment and other elements of the economy cycle through good and bad
times.