% function mortgage
% mortgage(67912.5, 4.98454, 15)
function payment = mortgage(principal, interest, years)
    I = interest/(100*12)
    months = years*12
    payment0 = principal/months
%function [zero, res, niter] = bisect(fun, a, b, tol,  nmax, varargin)
    [payment,res,niter] = ...
     bisect(@iter,100,1000,.001,100,principal,I,months)
%   payment = fzero(@iter,payment0,[],principal,I,months)

function balance = iter(payment,principal, I, months)
    balance = principal;
    for i = 1:months
        balance = balance*(1+I)-payment;
    end
   
