>% 3) predictive covariance matrix (non-central moments)</span>
<span class="keyword">for</span> i = 1:E
  K2 = K(:,:,i)+exp(2*X(D+2,i))*eye(n);
  ii = bsxfun(@rdivide,inp,exp(2*X(1:D,i)'));

  <span class="keyword">for</span> j = 1:i <span class="comment">% if i==j: diagonal elements of S; see Marc's thesis around eq. (2.26)</span>
    R = s*diag(exp(-2*X(1:D,i))+exp(-2*X(1:D,j)))+eye(D); t = 1./sqrt(det(R));
    <span class="keyword">if</span> rcond(R) &lt; 1e-15; fprintf(<span class="string">'R-matrix in