why buffer on simulink (r2019b) creates delay and how to solve it?

I use a buffer on simulink r2019b to produce 1000 samples per frame (per channel), but why is there a delay so that it produces a leading zero in front of it,
why can this happen and how to solve it? Thank you very much

5 Kommentare

Is that per frame or one time? Is the 1000th sample spilled to become the first sample of the next frame?
it only occurs in the first frame so it looks like there is a delay at first, for the next frame the value runs normally
I use 10 seconds, so the result is [1000x1x11] and at (:,:, 1) then it only produces all 0 values as in the image below.
and also I tried to see with the scope of the output from the buffer then I got a result like this so I said he might have a delay.
I have tried to find the reverse block of delay but it does not exist and is not possible because it is like prediction
I beg your help, I have a little time left.please @Walter Roberson
whereas this is the scope of the DSP sin discrete mode output with the same sample time and samples per frame @Walter Roberson

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 9 Jan. 2021

0 Stimmen

The DSP Buffer block is defined to hold the previous content until enough new samples have been received to fill a complete frame, at which point the output changes to the appropriate number of previous values.
Between the time the buffer operation starts and the time a full frame of samples have been received, the "previous content" is typically 0. You can configure for a different initial value in the properties of the DSP Buffer block, which also permits you to name a variable to receive the initial values from.
Note: you should probably also configure your scope to Frame Based: https://www.mathworks.com/help/simulink/slref/scope.html#d122e187735 "Input Processing"

3 Kommentare

how do I configure for a different initial value in the properties of the DSP Buffer block, help me a little more Mr @Walter Roberson I mean like the steps
I usually use array plots instead of scopes but I use scope to show the delay I mean Mr @Walter Roberson
Step 1: right click the Buffer block and select Block Parameters (Buffer)
Step 2: Fill in new Initial conditions
Then click Apply, and then OK.
However if you fill in a constant here, then the fft() result for the first buffer full is just going to be (length of buffer) times (that constant) for the first bin, and all of the other fft results for that first buffer full is going to be 0.
There is no peak available for the first buffer-full.
You need to either change your S-function to handle that case (which can happen anyhow because of silence!!), or else you need to use some kind of if/else or enabled block so that your S function is not called for the first buffer-full, or else you need to mix in some signal to interpose an artificial peak for the cases where your signal would otherwise be constant.

Melden Sie sich an, um zu kommentieren.

Produkte

Version

R2019b

Gefragt:

am 9 Jan. 2021

Kommentiert:

am 10 Jan. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by