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

    %% Price a Floating-Rate Note Using a Black-Karasinski Tree  
% Price a 20-basis point floating-rate note using a Black-Karasinski interest-rate
% tree.   

% Copyright 2015 The MathWorks, Inc.


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

%% 
% Define the floating-rate note using the required arguments. Other arguments
% use defaults. 
Spread = 20;
Settle = '01-Jan-2005';
Maturity = '01-Jan-2006';  

%% 
% Use |floatbybk| to compute the price of the note. 
Price = floatbybk(BKTree, Spread, Settle, Maturity)