%% Determine the Mortgage-Backed Security Price Using a Customized PrePaytMatrix
% This example shows how to determine the mortgage-backed security price, given a mortgage-backed security, and PrePaytMatrix with the following characteristics:

Yield = 0.0725;
Settle = datenum('15-Apr-2002');
Maturity = datenum('1 Jan 2030');
IssueDate = datenum('1-Jan-2000');
GrossRate = 0.08125;
PrepayMatrix = 0.005*ones(360,1);

[Price AccrInt] = mbsprice(Yield, Settle, Maturity, IssueDate,...
GrossRate, PrepayMatrix)

% Copyright 2012 The MathWorks, Inc.