diff --git a/matlab/print_expectations.m b/matlab/print_expectations.m
index 099933132c1c0b8f37e99edca2f66171994f8f40..e5ea95a72c4fef5c75723babc20e277a4895f3d6 100644
--- a/matlab/print_expectations.m
+++ b/matlab/print_expectations.m
@@ -251,6 +251,10 @@ if isequal(expectationmodel.auxiliary_model_type, 'trend_component')
     maxlag = maxlag+1;
 end
 
+if isequal(expectationmodelkind, 'var')
+    timeindices = (0:(maxlag-1))+abs(expectationmodel.time_shift);
+end
+
 if isequal(expectationmodelkind, 'var') && isequal(expectationmodel.auxiliary_model_type, 'var')
     id = id+1;
     expression = sprintf('%1.16f', M_.params(expectationmodel.param_indices(id)));
@@ -302,8 +306,8 @@ for i=1:maxlag
         end
         switch expectationmodelkind
           case 'var'
-            if i>1
-                variable = sprintf('dbase.%s(-%d)', variable, i-1);
+            if timeindices(i)>0
+                variable = sprintf('dbase.%s(-%d)', variable, timeindices(i));
             else
                 variable = sprintf('dbase.%s', variable);
             end