for jj=1:5 rest(jj,1)=1; for ii=1:600 rest(jj,ii+1)=rest(jj,ii)-((Zinsen+tilgung0(jj))/12-rest(jj,ii)*Zinsen/12); if rest(jj,ii+1)<=0 iii(jj)=ii+1; break; end end
average_Zinsen(jj)=0; for ii=1:iii(jj) average_Zinsen(jj)=average_Zinsen(jj)+rest(jj,ii); end average_Zinsen(jj)=average_Zinsen(jj)/iii(jj)*Zinsen; average_Zinsen(jj) end
for jj=1:5 rest(jj,1)=1; for ii=1:600 rest(jj,ii+1)=rest(jj,ii)-((Zinsen+tilgung0(jj))/12-rest(jj,ii)*Zinsen/12); if rest(jj,ii+1)<=0 iii(jj)=ii+1; break; end end
average_Zinsen(jj)=0; for ii=1:iii(jj) average_Zinsen(jj)=average_Zinsen(jj)+rest(jj,ii); end average_Zinsen(jj)=average_Zinsen(jj)/iii(jj)*Zinsen; average_Zinsen(jj) end
fp=fopen('loan1.out','w'); fprintf(fp,'%1 %1.5 %2 %2.5 %3\n'); for ii=1:iii(1) fprintf(fp,'%f %f %f %f %f %f\n',ii,rest(1,ii),rest(2,ii),rest(3,ii),rest(4,ii),rest(5,ii)); end fclose(fp);
ans =
0.0321
ans =
0.0309
ans =
0.0300
ans =
0.0294
ans =
0.0290 作者: 开洋 时间: 27.4.2003 15:01
function loan2()
% the program to calculate the loan interest and time to pay the loan