-
Notifications
You must be signed in to change notification settings - Fork 2
/
fcn_truthtable.m
19 lines (17 loc) · 1.39 KB
/
fcn_truthtable.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function update_matrix =fcn_truthtable(nodes)
n=numel(nodes); list_binary_states=fliplr(rem(floor((0:((2^n)-1)).'*pow2(0:-1:-n+1)),2));
update_matrix = [list_binary_states(:,1),...
list_binary_states(:,2),...
(list_binary_states(:,3) | list_binary_states(:,2)) & ~(list_binary_states(:,6) | list_binary_states(:,7) | list_binary_states(:,15)),...
list_binary_states(:,11) | list_binary_states(:,12),...
(list_binary_states(:,11) | list_binary_states(:,12)) & list_binary_states(:,2),...
(list_binary_states(:,6) | list_binary_states(:,3) | list_binary_states(:,14)) & ~list_binary_states(:,15) & ~list_binary_states(:,10),...
(list_binary_states(:,7) | list_binary_states(:,3) | list_binary_states(:,15)) & ~list_binary_states(:,15) & ~list_binary_states(:,10) & ~list_binary_states(:,6),...
(list_binary_states(:,1) | list_binary_states(:,2)) & (~list_binary_states(:,4) & list_binary_states(:,5)) & ~list_binary_states(:,10),...
list_binary_states(:,9) | list_binary_states(:,8),...
list_binary_states(:,10) | (list_binary_states(:,3) & list_binary_states(:,9)),...
list_binary_states(:,3),...
list_binary_states(:,11),...
list_binary_states(:,11) | list_binary_states(:,12),...
list_binary_states(:,11) | list_binary_states(:,12) | list_binary_states(:,3) | list_binary_states(:,13),...
(list_binary_states(:,3) | list_binary_states(:,15)) & ~list_binary_states(:,6) & ~list_binary_states(:,7) & ~list_binary_states(:,10)];