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