diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /45/CH2/EX2.12/example_2_12.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '45/CH2/EX2.12/example_2_12.sce')
-rwxr-xr-x | 45/CH2/EX2.12/example_2_12.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/45/CH2/EX2.12/example_2_12.sce b/45/CH2/EX2.12/example_2_12.sce new file mode 100755 index 000000000..276bbd6e2 --- /dev/null +++ b/45/CH2/EX2.12/example_2_12.sce @@ -0,0 +1,23 @@ +//Example 2.12
+clc
+clear
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16 // finding Y and y1 for all possible inpt cases
+ x=bitand(a(i),b(i));
+ y=bitand(c(i),d(i));
+ r(i)=bitor(x,y);
+ x1=bitcmp(x,1);
+ y1=bitcmp(y,1);
+ z=bitand(x1,y1);
+ r1(i)=bitcmp(z,1);
+end
+disp(' Y Y1');
+for i = 1 : 16 // displaying result
+ Y(i,1)=r(i);
+ Y(i,2)=r1(i);
+ end
+disp(Y);
+disp('Both are logically equivalent');
|