why buffer on simulink (r2019b) creates delay and how to solve it?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2021년 1월 9일
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
Walter Roberson
2021년 1월 10일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!