www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/UsegetForwardRatestoComputethe5YearForwardRatein5YearsTiExample.m

    %% Use getForwardRates to Compute the Five Year Forward Rate in Five Years Time  

%% 
% Use |getForwardRates| to compute the forward rate from the |Settle| date
% to 5 years from now and then the forward rate for the period from 5 years
% to 10 years from now. 
Data = [2.09 2.47 2.71 3.12 3.43 3.85 4.57 4.58]/100;
Dates = daysadd(today,[360 2*360 3*360 5*360 7*360 10*360 20*360 30*360],1);
irdc = IRDataCurve('Zero',today,Dates,Data);
getForwardRates(irdc,datemnth(irdc.Settle,12*[5 10])) 

%%
% The first element (|.0312|) is the forward rate from the |Settle| to 5
% years from now. The second rate (|0.0458|) is the forward rate for the
% period from 5 years to 10 years from now, in other words, the 5-year forward
% rate 5 years from now.