I wrote the following MATLAB code for the above function
function f=hamachersum(x,y)
f = zeros(numel(x),1);
for j=1:numel(x)
if x(j)==1 && y(j)==1
f(j,1)=1;
else
f(j,1)=(x(j)+y(j)-2*(x(j)*y(j)))/(1-(x(j)*y(j)));
end
end
end
Then I want to test t3=hamachersum(t1,t2)
My input values t1, t2
are
t1
t1 =
1.0000
0
1.0000
1.0000
1.0000
1.0000
NaN
0.8167
1.0000
1.0000
1.0000
0.4667
NaN
1.0000
1.0000
1.0000
NaN
NaN
1.0000
1.0000
1.0000
NaN
0.0250
1.0000
t2
t2 =
1.0000
0.5524
1.0000
1.0000
1.0000
1.0000
NaN
0
1.0000
1.0000
1.0000
1.0000
NaN
1.0000
1.0000
1.0000
NaN
NaN
0.6032
1.0000
1.0000
NaN
0.9973
0.7260
The result is
t3 =
1.2000
0.5524
1.0000
1.0000
1.0000
1.0000
NaN
0.8167
2.0000
2.0000
1.0000
1.0000
NaN
0.6667
1.0000
1.0769
NaN
NaN
1.0000
1.0000
1.0000
NaN
0.9973
1.0000
Why do I get values above 1. As this is a fuzzy operator it can't have values above 1.
Is there something wrong in my code?