What is the most elegant way to draw a timing diagram specified by a list of zeros and ones?
In the following code I attempt to draw the clock pulse diagram, and I'd like to continue drawing the timing diagram for a given input of 0's and 1's, e.g., {11011011,11100110}
.
clockWidth = 0.2;
pulseHgh = 0.1;
rowHgh = pulseHgh + 0.1;
pNum = 8;
diagWidth = 2;
yb = 0;
clock = Table[
Line[{ {xb,
yb} , {xb, yb} + {0, pulseHgh}, {xb, yb} + {clockWidth/2,
pulseHgh}, {xb, yb} + {clockWidth/2, 0}, {xb,
yb} + {clockWidth, 0}}], {xb, 0, clockWidth*pNum, clockWidth}];
txt = Table[
Text[Style[n, 12, Italic], {n*clockWidth + clockWidth/2,
yb + 0.13}], {n, 0, pNum}];
Graphics[{clock}, Epilog -> {Text["Clock", {2, yb}], txt},
PlotRange -> {-0.2, 0.2} ]
I'd like the result to look somewhat like the figure shown below.
Comments
Post a Comment