summaryrefslogtreecommitdiff
path: root/911/CH9/EX9.5.b/ex_9_5_b.sce
diff options
context:
space:
mode:
Diffstat (limited to '911/CH9/EX9.5.b/ex_9_5_b.sce')
-rw-r--r--911/CH9/EX9.5.b/ex_9_5_b.sce86
1 files changed, 86 insertions, 0 deletions
diff --git a/911/CH9/EX9.5.b/ex_9_5_b.sce b/911/CH9/EX9.5.b/ex_9_5_b.sce
new file mode 100644
index 000000000..2dc346d5a
--- /dev/null
+++ b/911/CH9/EX9.5.b/ex_9_5_b.sce
@@ -0,0 +1,86 @@
+//example 9.5(b)//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+close
+c = [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 ];
+//taking the values for a mod - counter
+q = [0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 ];
+a = [0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 ];
+b = [0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 ];
+y1=q;
+y2=a;
+y3=b;
+y11p =1;
+y22p =1;
+y33p =1;
+y44p =1;
+cp =1;
+yf1p =1;
+for i =1:17
+ // making arrays to draw the output
+if y1(i)==1 then
+for o =1:100
+y11 ( y11p )=1;
+y11p = y11p +1;
+end
+else
+for o =1:100
+y11 ( y11p )=0;
+y11p = y11p +1;
+end
+end
+if y2(i)==1 then
+for o =1:100
+y21 ( y22p )=1;
+y22p = y22p +1;
+end
+else
+for o =1:100
+y21 ( y22p )=0;
+y22p = y22p +1;
+end
+end
+if y3(i)==1 then
+for o =1:100
+y31 ( y33p )=1;
+y33p = y33p +1;
+end
+else
+for o =1:100
+y31 ( y33p )=0;
+y33p = y33p +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
+end
+z =[2 2];
+subplot (4 ,1 ,1);
+//ploting the output
+title ( ' Timing Diagram ' );
+plot (c1);
+plot (z);
+ylabel ( 'C ' );
+subplot (4 ,1 ,2);
+plot (y11);
+ylabel ( 'Q' );
+plot (z);
+subplot (4 ,1 ,3);
+plot (y21);
+ylabel ( 'A' );
+plot (z);
+subplot (4 ,1 ,4);
+plot (z);
+ylabel ( 'B ' );
+plot (y31); \ No newline at end of file