function [y,Qb]=beta_theta(lambda,D,theta);
%
% 2005.12
% Emmanuel Boss
% emmanuel.boss@maine.edu
% School of Marine Sciences, University of Maine, USA
%
% Calculates the VSF of calibration beads used for calibrating backscattering sensors.
%
%
% INPUT
% Incident light wavenumber in air              (lambda) [m] 
% Sphere diameter                               (D)      [m] 
% scattering angle                              (theta)    [degree]

% OUTPUT
% VSF                                           (beta)
% Scattering efficiency factor                  (Qb)


wl=lambda*10^6;
%refractive index of beads relative to air
np=1.5663 + 0.00785./(wl.^2) + 0.000334./(wl.^4);
%refractive index of medium
nm=1.3481216.*exp(-wl.*1000.*0.0000193465)+2.627716.*exp(-wl.*1000.*0.0153948);
n=np./nm;
%note, both lambda and D need to be with the same units
x=pi*D/lambda/nm;
nang=100*3+1;
dang=pi/2/(nang-1);
nan=2*nang-1;
[S1 S2 Qb Qc Qback]=bhmie(x,n,nang);
S11=0.5*((abs(S1)).^2 + (abs(S2)).^2);
ang=[0:dang:pi]*180/pi;

y=interp1(ang,S11,theta,'cubic');
Qb=Qb*ones(length(y));
