How to interpret time-scope waveforms linked to a 'buffer' block with buffer size = 2?

2 views (last 30 days)
Hi all. Just requesting some kind help regarding the usage of the 'buffer' block in my really simple .mdl simulink file.
My setup is just a random number generator that generates 10 random binary bits. Then I observe the generates bits with a time scope.
The generated 10 bits are then run through a buffer (with buffer size equal to 2). Then, the output of the buffer is taken to a "Convert 2D to 1D" block, and then I use another time scope to observe the output of that "2D to 1D" block.
I was expecting that the output of the '2D to 1D' block to have the same bit pattern as the initially generated 10 bits. But instead, the display on the time scope shows 2 different waveforms (one purple colour and one yellow colour).
Could I ask if anyone can help me understand the meaning of those two coloured waveforms, and how they relate to the original 10 bit random pattern?
Thanks very much in advance!

Answers (1)

Kenny
Kenny on 3 Mar 2014
Edited: Kenny on 3 Mar 2014
For my question above, I'm beginning to understand the pattern.
I can now see that the generated bit pattern is '1101001111'. Then, according to the buffer size '2', I break up the above pattern into pairs, such as 11-01-00-11-11
Or..re-arranged..the order is: 11 (pair #1) 01 (pair #2) 00 (pair #3) 11 (pair #4) 11 (pair #5)
Then I look at the waveforms in 'timescope 2'. There are 2 waveforms - a purple one and a yellow one. Now, from time 0 to 0.2, it appears that both waveforms are binary 'zero'. I don't know why it starts from both waveforms being zero. But I do notice that the action really starts to happen beginning from t = 0.2.
During t = 0.2 to 0.4, both the yellow and the purple waveform are logic '1'. The purple waveform always seems to COVER-UP the yellow one, but both are at logic '1' at time t = 0.2. This corresponds to '11', which is really pair #1!
Then, during period between t = 0.2 to 0.6, the yellow waveform is '0' and the purple waveform is '1', which corresponds to pair #2 (which is '01' - noting that the 1st index corresponds to yellow, while the 2nd index corresponds to purple).
Then during the period between t = 0.6 to 0.8, we have yellow and purple both being '0'. So this is pair #3, which is '00'
And the pattern continues.
So I know more or less what is going on. But I'm not sure how to explain the period of inactivity at the beginning (from t = 0 to 0.2), where both waveforms are at zero level.
I now also understand that the output of the block called 'Convert 2D to 1D' will be 2 numbers (due to the buffer size being '2') - so that the time scope will plot both of these numbers at the same time - hence yellow and the purple waveforms. But I still don't know why there's no activity during t = 0 to t = 0.2.
Comments really welcome! Thanks!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!