k = {1,2,3,4,5};
v = {0.1,0.3,0.2,0.2,0.6};
k1 = {1,5,6,7,8};
v1 = {0.8,0.6,0.2,0.2,0.6};
fset1 = containers.Map(k, v);
fset2 = containers.Map(k1, v1);
the above are my fuzzy sets . i want to find the union and intersection of these 2 fuzzy sets. I am unable to think of a logic to implement the union and intersection of these 2 fuzzy sets in matlab.
First to clarify something, there is no single fuzzy intersection or union operation. There is an infinite intersection and union family called Triangular Norms and Triangular Conorms.
Having said that, in classical fuzzy theory, the "default", so to speak, intersection is taken to be the "minimum" of all elements, and union to be the "maximum" of all elements. I.e.
If you're simply performing operations in pairs, then you can simply say
(and similarly max
when dealing with unions).
I'm not quite sure what you're doing with keys and values there, but basically if you have two fuzzy sets expressed in vector form (i.e. each position in the vector corresponds to an element, and the presence or absence of that element in the set is denoted with 1 and 0 respectively, and a fuzzy value in the range [0,1] represents ambiguity to that extent), then all you need to do to get the intersection is to get the minimum of the two vectors at each position, i.e.
>> f1 = rand([1,10])
f1 =
0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157 0.7922 0.9595
>> f2 = rand([1,10])
f2 =
0.6557 0.0357 0.8491 0.9340 0.6787 0.7577 0.7431 0.3922 0.6555 0.1712
>> fuzzy_intersection = min(f1, f2)
fuzzy_intersection =
0.1576 0.0357 0.8491 0.4854 0.6787 0.1419 0.4218 0.3922 0.6555 0.1712