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

Yield = 0.07298413;
Settle = '15-Apr-2002';
Maturity = '1 Jan 2030';
IssueDate = '1-Jan-2000';
GrossRate = 0.08125;
Speed = 100;
CouponRate = 0.075;
Delay = 14;

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

% Copyright 2015 The MathWorks, Inc.