Ticket #7383: flatBGpo.m

File flatBGpo.m, 244 bytes (added by Mike Thomas, 7 years ago)
Line 
1function C = flatBGpo(x,y,sig,A)
2%Poisson Cost function for flat background
3C = 0;
4A = A(1);
5for i = 1:length(x)
6    if sig(i) == 0
7        C = C + 2*(A-y(i));
8    else
9        C = C + 2*((A-y(i))+y(i)*(log(y(i))-log(A)));
10    end
11end