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

    %% Calculate Cash Flows for Each PAC Tranche  
% Define the mortgage pool under consideration for CMO structuring using
% |mbscfamounts| or |mbspassthrough|. Calculate the underlying mortgage
% cash flow, define the PAC schedule and CMO tranches, and calculate the
% cash flows for each tranche.    

% Copyright 2015 The MathWorks, Inc.


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

[PrincipalBalance, MonthlyPayments, SchedPrincipalPayments, ...
InterestPayments, Prepayments] = ...
mbspassthrough(MortgagePrincipal, Coupon, Terms, Terms, 0, []);
PrincipalPayments = SchedPrincipalPayments.' + Prepayments.'  

%% 
% Calculate the PAC schedule for CMO using |cmosched|. 
PrepaySpeed = [100 300];
[BalanceSchedule, InitialBalance] ...
= cmosched(MortgagePrincipal, Coupon, Terms, Terms, PrepaySpeed, [])  

%% 
% Define CMO tranches. 
TranchePrincipals = ...
[InitialBalance; MortgagePrincipal-InitialBalance];
TrancheCoupons = [0.12; 0.12];  

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