由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 还保有房子多少年才值得no cost refi (附code) (转载)
相关主题
is it possible to design a zero miss rate cache?困扰多时的MATLAB crash问题
大家看看怎么把这几行matlab 代码译成czero-sized array vs pointer
一个关于simple cycle with zero weight的问题菜鸟求助 matlab code 问题
CheckForZero包子求助matlab编程问题
Any body here developed the program for first-principles calculations ?Principles of Reactive Programming 网上课程
[合集] a confusing C language questionInterface segregation principle似乎没啥意义啊
怎么判断一块连续内存区域为零?谁有Big Data (Nathan Marz)书可以share? (转载)
question on divide by zero谁来说说ZERO COPY和KERNEL Bypass networking
相关话题的讨论汇总
话题: refi话题: year1话题: own0话题: intr话题: mort
进入Programming版参与讨论
1 (共1页)
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;
1 (共1页)
进入Programming版参与讨论
相关主题
谁来说说ZERO COPY和KERNEL Bypass networkingAny body here developed the program for first-principles calculations ?
Principles of Reactive Programming[合集] a confusing C language question
求Big Data Principles and best practices of scalable realti (转载)怎么判断一块连续内存区域为零?
[KJPT]谷歌在补丁发布日前披露Windows漏洞 微软怒了 (转载)question on divide by zero
is it possible to design a zero miss rate cache?困扰多时的MATLAB crash问题
大家看看怎么把这几行matlab 代码译成czero-sized array vs pointer
一个关于simple cycle with zero weight的问题菜鸟求助 matlab code 问题
CheckForZero包子求助matlab编程问题
相关话题的讨论汇总
话题: refi话题: year1话题: own0话题: intr话题: mort