www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/CalculateCashFlowsforaSequentialCollateralizedMortgageObExample.m

    %% Calculate Cash Flows for a Sequential Collateralized Mortgage Obligation (CMO)  
% Define the mortgage pool under consideration for CMO structuring using
% |mbscfamounts| or |mbspassthrough| and calculate the cash flows with an
% A and B tranche for a sequential CMO.   

% Copyright 2015 The MathWorks, Inc.


%% 
MortgagePrincipal = 1000000;
Coupon = 0.12;
Terms = 6; % months

% Calculate underlying mortgage cash flows
[PrincipalBalance, MonthlyPayments, SchedPrincipalPayments, ...
InterestPayments, Prepayments] = ...
mbspassthrough(MortgagePrincipal, Coupon, Terms, Terms, 0, []);
PrincipalPayments = SchedPrincipalPayments.' + Prepayments.'  

%% 
% Define CMO tranches, A and B. 
TranchePrincipals = [500000; 500000];
TrancheCoupons = [0.12; 0.12];  

%% 
% Calculate cash flows for each tranche. 
[Balance, Principal, Interest] = ...
cmoseqcf(PrincipalPayments, TranchePrincipals, TrancheCoupons, false)