diff --git a/matlab/ep/extended_path.m b/matlab/ep/extended_path.m
index 0efdfeb1260b7a755a214bdb097e2ae1a2539991..bc98ed25afad0132ffeb1d003f597e9e713b2e0a 100644
--- a/matlab/ep/extended_path.m
+++ b/matlab/ep/extended_path.m
@@ -115,7 +115,7 @@ bytecode_flag = options_.ep.use_bytecode;
 % Simulate shocks.
 switch options_.ep.innovation_distribution
   case 'gaussian'
-      oo_.ep.shocks = randn(sample_size,effective_number_of_shocks)*covariance_matrix_upper_cholesky;
+      oo_.ep.shocks = transpose(transpose(covariance_matrix_upper_cholesky)*randn(effective_number_of_shocks,sample_size));
   otherwise
     error(['extended_path:: ' options_.ep.innovation_distribution ' distribution for the structural innovations is not (yet) implemented!'])
 end