This should be close to what you want. However, I have used the logical not, and, and or functions which appear to be diffferent that your definitions of functionNot, functionAnd, and functionOr. You can replace these with calls to your functions.
clearvars; clc;
x=[1 1 1 0 0 0 2 2 2];
y=[1 0 2 1 0 2 1 0 2];
fprintf(' x y tNot(x) tAnd(x,y) tOr(x,y)\n');
for r=1:9
fprintf('%5d%5d%10d%10d%10d\n', x(r), y(r), not(x(r)), and(x(r), y(r)), or(x(r), y(r)));
end
Result:
x y tNot(x) tAnd(x,y) tOr(x,y)
1 1 0 1 1
1 0 0 0 1
1 2 0 1 1
0 1 1 0 1
0 0 1 0 0
0 2 1 0 1
2 1 0 1 1
2 0 0 0 1
2 2 0 1 1
Best Answer