function out=LL_ExpDecay(params,t,data)

A=params(1);
tau=params(2);
B=params(3);

model=A*exp(-t/tau)+B;

%Note I'm dropping the contant term of log(data!)

LL=sum( -model + data.*log(model) );

out=-LL; %minimize the negative of the log likelihood
