%% Compute the Yield of a Treasury Bond Using the Same Basis for Discounting and Generating the Cash Flows
% Compute the yield of a Treasury bond.

Price = [95; 100; 105];
CouponRate = 0.0345;
Settle = '15-May-2016';
Maturity = '02-Feb-2026';
Period = 2;
Basis = 1;
format long

Yield = bndyield(Price,CouponRate,Settle,Maturity,Period,Basis)

%
% Using the same data, compute the yield of a Treasury bond using the same basis for discounting and generating the cash flows.

DiscountBasis = 1;

Yield = bndyield(Price,CouponRate,Settle,Maturity,'Period',Period,'Basis',Basis, ...
'DiscountBasis',DiscountBasis)

% Copyright 2012 The MathWorks, Inc.