1. ## MATLAB "bisection" method

How to create a MATLAB function that uses the bisection method to find the value of the interest rate "r" implicit in a loan that specifies the borrowed amount 'L", the monthly payment "C", the number of years "T", and the number of capitalizations per year "n" ???

I got the formula, but don't know what to do....

C = L0 { r/n + (r/n)/[(1+ r/n)^Tn]-1] }

2. Im not sure if I deciphered your equation correctly but this code might help you out a little bit.

Code:
clear
clc
% http://en.wikipedia.org/wiki/Bisection_method

L = 400000;       %Loan amount
n = 12;         %monthly compounds
T = 30;         %years
C = 2400;       %Rate

epsilon = 0.0000001; %Error to exit on

%Bounds for r
ri = 0.05; % lower bound
rj = 0.15;   %upper bound

i = 0; %start counter

while abs(rj-ri) > 2*epsilon;
i = i +1; %keep track of iterations

rm = (rj+ri)/2; %mid point

Si = L *( ri/n + (ri/n)/((1+ ri/n)^((T*n)-1))) - C; %evaluate function at lower bound
Sj = L *( rj/n + (rj/n)/((1+ rj/n)^((T*n)-1))) - C;%evaluate function at upper bound
Sm = L *( rm/n + (rm/n)/((1+ rm/n)^((T*n)-1))) - C;%evaluate function at midpoint

if Si*Sm > 0
ri = rm;
else
rj = rm;
end
end
r = (ri+rj)/2;
disp(['Solution found in ' num2str(i) ' iterations'])
disp(['r = ' num2str(r)]);
disp(['Evaluateing S @ r, S = ' num2str(L*(r/n + (r/n)/((1+ r/n)^((T*n)-1))) - C)])
You should get a output in the comand window that looks something like this

Code:
Solution found in 19 iterations
r = 0.06229
Evaluateing S @ r, S = -0.0006425
Regards, Elabrto