IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
sigfun.m
Go to the documentation of this file.
1 %>@ingroup maths
2 %>@file
3 %>@brief Sigmoid function
4 %>
5 %> @sa biocomparer
6 %
7 %> @param x argument (works with vectors and matrices as well
8 %> @param hh =45. "half-height". Defaults to 45 cm^{-1}
9 %> @param flag_demo If passed, will generate its own @c x (passed @c x will be ignored) and a figure
10 function y = sigfun(x, hh, flag_demo)
11 
12 s = 6;
13 
14 if nargin < 2 || isempty(hh)
15  hh = 45;
16 end;
17 
18 if nargin > 2
19  x = -1:.01:hh*2;
20 end;
21 
22 y = (1+exp(-s))./(1+exp((x-hh)*s/hh));
23 
24 if nargin > 2
25  figure;
26  plot(x, y);
27  hold on;
28  plot([hh, hh], [0, 1], 'r--');
29  xlim([0, hh*2]);
30  set(gca, 'xtick', [0, hh, hh*2]);
31 end;
32 
33 
34 
Analysis Session (AS) base class.
Definition: as.m:6
function sigfun(in x, in hh, in flag_demo)