function f = fmbloss(phi)
n1 = 1.491;
n2 = 1.405;
ns1 = n1*n1;
ns2 = n2*n2;
lambda = 0.58e-6;
ra1 = 0.5e-3;
kw = 2*pi/lambda;
bend_r = 10e-3;
thetac = acos(n2/n1);
rad = @(theta) (bend_r+ra1)*n1./(n2*cos(theta));
n1_phi = @(theta) (sqrt(ns1-ns1*cos(theta).*cos(theta)));
n2_phi = @(theta) (sqrt(ns1*cos(theta).*cos(theta)-ns2));
p = @(theta) (rad(theta)/(bend_r+ra1));
ps = @(theta) (p(theta).*p(theta));
ps1 = @(theta) (sqrt(ps(theta)-1));
log_p = @(theta) (log(p(theta)+ps1(theta)));
abs_t = @(theta) (4*n1_phi(theta).*n2_phi(theta)/(ns1-ns2));
expf = @(theta) (-2*kw*ra1*n1*cos(theta).*(log_p(theta)-ps1(theta)./p(theta)));
bt = @(theta) (abs_t(theta).*expf(theta));
sub_sin = @(theta) (sqrt(sin(theta).*sin(theta)-sin(thetac)*sin(thetac)));
sub_sins = @(theta) (sin(theta)+sub_sin(theta).*sub_sin(theta));
bt1 = @(theta) (4*sin(theta).*sub_sin(theta)./(sub_sins(theta)));
exp_f1 = @(theta) exp(-bt(theta)*phi./(2*theta));
exp_f2 = @(theta) exp(-bt(theta)*bend_r*phi.*theta/(4*ra1));
exp_f3 = @(theta) exp(-bt1(theta)*bend_r*phi/(4*ra1));
fun1 = @(theta) (exp_f1(theta));
fun2 = @(theta) (exp_f2(theta));
fun3 = @(theta) (exp_f3(theta));
theta_max = sqrt(2*ra1/bend_r);
int1 = quadl(fun1,0,theta_max);
int2 = quadl(fun2,theta_max,thetac);
int3 = quadl(fun3,thetac,pi/2);
f = pi*(int1+int2+int3)/2;