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.11/example_2_11.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.11/example_2_11.sce')
-rwxr-xr-x | 45/CH2/EX2.11/example_2_11.sce | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/45/CH2/EX2.11/example_2_11.sce b/45/CH2/EX2.11/example_2_11.sce new file mode 100755 index 000000000..cd85ad755 --- /dev/null +++ b/45/CH2/EX2.11/example_2_11.sce @@ -0,0 +1,99 @@ +// exmple 2.11
+clc
+clear
+close
+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
+ x=bitor(a(i),b(i));
+ y=bitor(c(i),d(i));
+ r(i)=bitand(x,y);
+end
+Y=r
+ap=1;
+bp=1;
+cp=1;
+dp=1;Yp=1;
+for i=1:16 //Making array to plot the timing diagram
+ if a(i)==1 then
+ for o=1:100
+ a1(ap)=1;
+ ap=ap+1;
+ end
+ else
+ for o=1:100
+ a1(ap)=0;
+ ap=ap+1;
+ end
+end
+if b(i)==1 then
+ for o=1:100
+ b1(bp)=1;
+ bp=bp+1;
+ end
+ else
+ for o=1:100
+ b1(bp)=0;
+ bp=bp+1;
+ end
+
+end
+if c(i)==1 then
+ for o=1:100
+ c1(cp)=1;
+ cp=cp+1;
+ end
+ else
+ for o=1:100
+ c1(cp)=0;
+ cp=cp+1;
+ end
+end
+if d(i)==1 then
+ for o=1:100
+ d1(dp)=1;
+ dp=dp+1;
+ end
+ else
+ for o=1:100
+ d1(dp)=0;
+ dp=dp+1;
+ end
+ end
+if Y(i)==1 then
+ for o=1:100
+ Y1(Yp)=1;
+ Yp=Yp+1;
+ end
+ else
+ for o=1:100
+ Y1(Yp)=0;
+ Yp=Yp+1;
+ end
+ end
+end
+z=[2 2];
+subplot(5,1,1); //plotting timing diagram
+title('Timing Diagrm');
+plot(z);
+plot(a1);
+ylabel('A');
+subplot(5,1,2);
+plot(z);
+ylabel('B');
+plot(b1);
+subplot(5,1,3);
+plot(z);
+ylabel('C');
+plot(c1);
+subplot(5,1,4);
+plot(z);
+ylabel('D');
+plot(d1);
+subplot(5,1,5);
+plot(z);
+ylabel('Y');
+xlabel('Time in milli seconds');
+plot(Y1);
\ No newline at end of file |