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

    %% Price a Bond Using an HJM Tree  
% Price a 4% bond using an HJM interest-rate tree.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Load |deriv.mat|, which provides |HJMTree|. The |HJMTree| structure contains
% the time and interest-rate information needed to price the bond.  
load deriv.mat;   

%% 
% Define the bond using the required arguments. Other arguments use defaults. 
CouponRate = 0.04;
Settle = '01-Jan-2000';
Maturity = '01-Jan-2004';  

%% 
% Use |bondbyhjm| to compute the price of the bond. 
Price = bondbyhjm(HJMTree, CouponRate, Settle, Maturity)