%% Compute the Convexity of a Mortgage Pool Given Yield
% This example shows how to compute the convexity of mortgage pool given yield for a mortgage-backed security with the following characteristics.

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

Convexity = mbsconvy(Yield, Settle, Maturity, IssueDate, ... 
GrossRate, CouponRate, Delay, Speed)

% Copyright 2015 The MathWorks, Inc.