Skip to content

Commit e8ef0bc

Browse files
authored
Merge pull request opencobra#1782 from rmtfleming/xomicsJun2
logarithmic modulus
2 parents 35641fc + 03e88eb commit e8ef0bc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function y = logmod(x,base)
2+
% log modulus function
3+
%
4+
% INPUT
5+
% x n x 1 real vector
6+
%
7+
% OPTIONAL INPUT
8+
% base exp(1),2,10
9+
if ~exist('base','var')
10+
y = sign(x).*log1p(abs(x));
11+
else
12+
switch base
13+
case exp(1)
14+
y = sign(x).*log1p(abs(x));
15+
case 2
16+
y = sign(x).*log2(1+abs(x));
17+
case 10
18+
y = sign(x).*log10(1+abs(x));
19+
otherwise
20+
error('base not recognised')
21+
end
22+
end
23+
24+
end
25+

0 commit comments

Comments
 (0)