%% Find Bond Convexity Given Price Using datetime Inputs
% This example shows how to compute the convexity of three bonds given their prices using datetime inputs.

Price = [106; 100; 98];
CouponRate = 0.055;
Period = 2;
Basis = 0;
Settle = datetime('02-Aug-1999','Locale','en_US');
Maturity = datetime('15-Jun-2004','Locale','en_US');
[YearConvexity, PerConvexity] = bndconvp(Price,...
CouponRate, Settle, Maturity, Period, Basis)

% Copyright 2012 The MathWorks, Inc.