%% Calculate Cash Flow Amounts and Dates, Time Factors, and Mortgage Factors for a Single Mortgage
% Given a mortgage with the following characteristics, compute the cash flow amounts and dates, the time factors, and the mortgage factors.
% 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.

[CFlowAmounts, CFLowDates, TFactors, Factors] = ... 
mbscfamounts(Settle, Maturity, IssueDate, GrossRate, ... 
CouponRate, Delay, PrepaySpeed)

% The result is contained in four 334-element row vectors.
% Copyright 2015 The MathWorks, Inc.