From f687b531fd07bab79cff86b38ad709ba832ebd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Ry=C3=BBk=29?= <stepan@adjemian.eu> Date: Sat, 11 Dec 2021 18:44:01 +0100 Subject: [PATCH] Bug fix (wrong indexing in present value evaluation). --- matlab/+var_expectation/update_parameters.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/+var_expectation/update_parameters.m b/matlab/+var_expectation/update_parameters.m index f6f638b805..df6aed8659 100644 --- a/matlab/+var_expectation/update_parameters.m +++ b/matlab/+var_expectation/update_parameters.m @@ -179,8 +179,8 @@ else % Define the discounted companion matrix DiscountedCompanionMatrix = discountfactor*CompanionMatrix; % First compute the parameters implied by the discounted sum from h=0 to h=horizon(1)-1 - tmp1 = eye(n); - for h=1:horizon(1) + tmp1 = zeros(n); + for h=0:horizon(1)-1 tmp1 = tmp1 + mpower(DiscountedCompanionMatrix, h); end tmp1 = alpha*tmp1; -- GitLab