Friday, December 15, 2006

logit - expit


%% maps (0,b) into (-inf,inf)
%% inverse of expit
%% usage: logit(x,b) or logit(x)
%% b defaults to 1
function y = logit(x,b)
if nargin<2
b = 1;
end
y = log( x ./ (b - x) );

%% maps (-inf, inf) into (0,b)
%% inverse of logit
%% usage: expit(x,b) or expit(x)
%% b defaults to 1
function y = expit(x,b)
if nargin<2
b = 1;
end
y = b./(1+exp(-x)) ;

No comments:

Contributors

google