%% Find the Duration of a Mortgage Pool
% This example shows how to find the duration of mortgage pool given a mortgage-backed security with the following characteristics.

Price = 101;
Settle = datenum('15-Apr-2002');
Maturity = datenum('1 Jan 2030');
IssueDate = datenum('1-Jan-2000');
GrossRate = 0.08125;
CouponRate = 0.075;;
Delay = 14;
Speed = 100;

[YearDuration, ModDuration] = mbsdurp(Price, Settle, Maturity,... 
IssueDate, GrossRate, CouponRate, Delay, Speed)

% Copyright 2015 The MathWorks, Inc.