
       <span class="keyword">for</span> i = 1:Ns
           h = hist(Xmode(i,:),xr);
           Px = Px + h*Pmode(i);
       <span class="keyword">end</span>

   <span class="keyword">end</span>  <span class="comment">% ---------------------------------------------- end MC loop</span>

<span class="keyword">end</span> <span class="comment">% k loop</span>


<span class="comment">% normalize marginal posterior</span>
Px = Px/sum(Px);

<span class="comment">% viz posterior histogram</span>
figure
subplot(211