MATLAB Answers

stani S.

starting Simulink -- the output from Repeat and Integrate blocks

Asked by stani S.
on 4 Feb 2013

I have some basic questions related to Simulink blocks: Repeat and Integrate and Dump.

My scheme looks like this:

Bernoulli Binary generator -> Repeat(10x) -> Integrate and Dump (10 samples).

So, I'd like to simply generate a random sequence, repeat each sample 10 times, then integrate every 10 samples to produce 1 output sample. But, it doesnt work this way. At the output of Bernoulli generator I see that each sample is already repeated 10 times. Why? Then, it goes to the Repeat block, so the outputs from Bernoulli and Repeat block look indentical. Then, after Integrate and Dump block, I dont get 10 times less samples but the same number of samples as the input sequence (original sequence*10). Why?

Any explanation is wellcome. Thank you.

  1 Comment

Can you post your model? Also it's not clear for me.

2 Answers

Answer by Azzi Abdelmalek
on 4 Feb 2013
Edited by Azzi Abdelmalek
on 4 Feb 2013

If you want to check your model, add a to, workspace block, repeat your sequence 2 times, and 4 times, then compare your two y


Answer by stani S.
on 4 Feb 2013
Edited by stani S.
on 4 Feb 2013

I'm not sure how I can post my model, but I can try to explain it better:

Bernoulli Binary Generator --> Repeat (10x) --> Integrate and Dump (10x)

                 a(n)          x(n)                 y(n)
So, at the output of Bernoulli generator I have a sequence a(n).
At the output od Repeat block I have x(n).
At the output of Intergate and Dump block I have y(n).

These outputs look like this:

a(n) 11111111110000000000111111111111111111110000000000 ....

x(n) 11111111110000000000111111111111111111110000000000 ....

y(n) 12345678910000000000012345678910123456789100000000000....

And I expected the following:

a(n) 10110

x(n) 11111111110000000000111111111111111111110000000000 (a(n) repeated 10x)

y(n) 10 0 10 10 0


Just under start time change type from variable step to fixed step, then just under it, set the fixed step size to 0.1. change also, the solver from continuous to discrete.

In your blocks set all sample time to -1(inherited).

Now I'm getting the erro on Repeat block:

Error reported by S-function 'sdspupsamp2' in 'test2/Repeat':All sample times for this block must be discrete. No continuous or constant sample times are allowed.

Then change the setting of the repeat block

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!