-
Notifications
You must be signed in to change notification settings - Fork 2
/
OBC_App_2_M_matrix.m
59 lines (41 loc) · 1.43 KB
/
OBC_App_2_M_matrix.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
%Policy application from the OBC paper (NK model), analysis of the M matrix.
%To study a different example, simply change the parameters and matrices
%Model matrices are defined in the 'Insert' files
%Written by Michael Hatcher ([email protected]). Any errors are my own.
clc; clear; %close all;
%Size of M matrix
T_guess = 16;
%Parameter values
sigma = 1;
PI_coef = linspace(1.001,4,80); %PI_coef = linspace(0.001,4,80) %PLT
DY_coef = linspace(0.001,3,80);
Z = ones(length(PI_coef),length(DY_coef));
for ll=1:length(PI_coef)
for mm=1:length(DY_coef)
thetta_pi = PI_coef(ll);
thetta_dy = DY_coef(mm);
% Model and calibration
run Insert_App_2_loop
%run Insert_App_2_loop_PLT
%No. of variables
nvar = length(B1(:,1)); %No. vars in x
%Initial values
e_vec = zeros(1,T_guess+1);
X_init = zeros(nvar,1); %Initial value
% Find terminal solution
run Cho_and_Moreno
% Check if M is a P matrix
not_P = NaN;
run M_matrix
run P_matrix
if not_P == 1
Z(ll,mm) = -1;
end
end
end
line(1:length(DY_coef)) = 1;
[X,Y] = meshgrid(DY_coef,PI_coef);
figure(1)
subplot(1,3,1), contourf(X,Y,Z,1), colormap(hot), title('\sigma = 1'), %title('\rho_i = 0.4')
xlabel('\theta_{\Delta y}'), ylabel('\theta_\pi'), xlim([0,inf]),
ylim([1,inf]), hold on, %plot(DY_coef,line,'--k')