function f = svenssonf(param,n);  %Instantaneous forward rate
beta0=param(1); beta1=param(2); beta2=param(3); beta3=param(4); tau1=param(5); tau2=param(6);
f1=exp(-n/tau1);
f2=(n/tau1).*f1;
if isnan(tau2)==0;
f3=(n/tau2).*exp(-n/tau2);
f=beta0+(beta1*f1)+(beta2*f2)+(beta3*f3);
else;
f=beta0+(beta1*f1)+(beta2*f2);
end;    
