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

    %% Price a Bond with an Amortizing Schedule  
% Price a bond with an amortizing schedule using the |Face| input argument
% to define the schedule.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define data for the interest-rate term structure. 
Rates = 0.065;
ValuationDate = '1-Jan-2011';
StartDates = ValuationDate;
EndDates=  '1-Jan-2017';
Compounding = 1;  

%% 
% Create the |RateSpec|. 
RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', StartDates,...
'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding)  

%% 
% Create and price the amortizing bond instrument. The bond has a coupon
% rate of 7%, a period of one year, and matures on 1-Jan-2017. 
CouponRate = 0.07;
Settle ='1-Jan-2011';
Maturity = '1-Jan-2017';
Period = 1;
Face = {{'1-Jan-2015' 100;'1-Jan-2016' 90;'1-Jan-2017' 80}};
Price = bondbyzero(RateSpec, CouponRate, Settle, Maturity, 'Period',...
Period, 'Face', Face)   

%% 
% Compare the results with price of a vanilla bond. 
PriceVanilla = bondbyzero(RateSpec, CouponRate, Settle, Maturity,Period)
%% 
% Price both the amortizing and vanilla bonds.
Face = {{'1-Jan-2015' 100;'1-Jan-2016' 90;'1-Jan-2017' 80};
         100};
PriceBonds = bondbyzero(RateSpec, CouponRate, Settle, Maturity, 'Period',...
               Period, 'Face', Face)