s***e 发帖数: 5242 | 1 【 以下文字转载自 Living 讨论区 】
发信人: sukye (勤奋的小苏), 信区: Living
标 题: 还保有房子多少年才值得no cost refi (附code)
发信站: BBS 未名空间站 (Tue Oct 2 17:35:08 2012, 美东)
目前 principle:P
cost C
rate R1
no cost rate R2
那么对有closing fee的情况,我的新贷款就是 P+C,然后直接算月付?
我的情况:20w principle, R1=2.5, R2=3,C=4k,银行说再住3年以上有cost的合算。
但是我自己算的的不是这个结果。
下面的matlab code分别算两种情况下多少钱付利息了:
clear;
rate1 = 3.5;
rate2 = 2.5;
rate3 = 3.0;
year_refi = 1.5;
year1 = 15;
year2 = year1-year_refi;
loan = 200;
cost = 4;
rent = zeros(year1*12,4);
[paid0,own0] = mort_su(loan, year1, rate1, year_refi);
for i =year_refi*12:year1*12
[paid1,own1] = mort_su(loan, year1, rate1, i/12);
[paid2,own2] = mort_su(loan-own0+cost,year2,rate2,i/12-year_refi);
[paid3,own3] = mort_su(loan-own0,year2,rate3,i/12-year_refi);
rent(i,:,:,:) = [i,paid1-own1,paid0-own0+paid2-own2,paid0-own0+paid3-own3];
end
rent
-----------------
function [paid,own] = mort_su(total, year, rate, nth)
total = total;
intr_m = rate/100/12; % monthly rate
mm = year*12; % month
pay_m = total*(intr_m*(1.0+intr_m)^mm)/((1.0+intr_m)^mm-1.0); %monthly pay
paid = pay_m*nth*12; % total paid
current = total;
for i=1:nth*12
current = current - (pay_m - current * intr_m);
end
own = total - current; |
|