function [features1 features2] = simMutuallyExclusive(dim, p) % Generate feature matrix based on mutual exclusion % Inputs: % 1. dim- number of features % 2. p- constant % If P(ith feature = 1) = p for one class, P = 0 for the other class. % Output: % 1. features1 - feature matrix using class1 % 2. features2 - feature matrix using class2 for i= 1:dim % if rand number > 0.5, classOne = p, classTwo = 0 % otherwise classOne = 0, classTwo = p tmp = rand(); if(tmp >= 0.5) classOne(i) = p; classTwo(i) = 0; else classOne(i) = 0; classTwo(i) = p; end end % populating features1 and features2 for i = 1:dim tmp = rand(); if(tmp <=classOne(i)) features1(i)=1; else features1(i)=0; end tmp = rand(); if(tmp <= classTwo(i)) features2(i)=1; else features2(i)=0; end end