r rate is taken as 32-year rate</p><h2>1. Set Up<a name="3"></a></h2><pre class="codeinput">simTenor = get(ns,<span class="string">'simTenor'</span>);
ttm=linspace(min(simTenor),max(simTenor),<span class="keyword">...</span>
	     (max(simTenor)-min(simTenor))/min(simTenor)+1);

para = get(ns,<span class="string">'parameters'</span>);    <span class="comment">%get model parameters</span>
K=size(para.X,1);
<span class="keyword">for</span>(i=1:get(ns,<span class="string">'dim'</span>))  <span class="comment">