Skip to content

Commit 57d1ead

Browse files
author
fabian.froehlich
committed
fix problems with heaviside(0) = 1/2
1 parent b633deb commit 57d1ead

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

symbolic/am_if.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@
22
% syms x y z
33
% f = symfun(sym('am_if(x,y,z)'),[x y z]);
44
% fun = f(condition, truepart, falsepart);
5-
fun = falsepart + heaviside(condition)*(truepart-falsepart);
5+
if(islogical(condition))
6+
if(condition)
7+
fun = truepart;
8+
else
9+
fun = falsepart;
10+
end
11+
else
12+
if(logical(condition~=0))
13+
fun = falsepart + heaviside(condition)*(truepart-falsepart);
14+
else
15+
fun = falsepart;
16+
end
17+
end
618
end

0 commit comments

Comments
 (0)