%% Calculate Payment, Principal, Interest, and Prepayment for a Single Mortgage
% Given a mortgage with the following characteristics, compute payments, principal, interest, and prepayment.
% Define the mortgage characteristics.

Settle      = datenum('17-April-2002');
Maturity    = datenum('1-Jan-2030');
IssueDate   = datenum('1-Jan-2000');
GrossRate   = 0.08125;
CouponRate  = 0.075;
Delay       = 14;
PrepaySpeed = 100;

%
% Use mbscfamonts to evaluate the mortgage.

[Payment, Principal, Interest, Prepayment] = ... 
mbscfamounts(Settle, Maturity, IssueDate, GrossRate, ... 
CouponRate, Delay, PrepaySpeed)

% Copyright 2015 The MathWorks, Inc.