I am currently try to implement a circular buffer block in Simulink, since I do not have access to the DSP Toolbox. The idea is to store chunks of signal along a real-time simulation for further processing of the windowed signal. The buffer should have the following features:
- user-defined length
- user-defined initial conditions
- update only the oldest buffer value
So far I've come up with the Simulink model attached to this question. Although correctly working (I tested it against the results derived from a standard DSP-Toolbox Buffer block with similar input values), such models evidences two major drawbacks:
- the buffer length is now directly given within the function, whereas I'd like allowing the user to define the length. Clearly, the size won't change during the simulation, but it should be sort of "input" for the buffer.
- the initial condition is forced to be 0, but to better tracke whether the buffer is filled or not, I'd like setting the initial condition to 99999 as an example. Clearly, also such a value should be tunable when setting up the simulation.
Could you suggest any valid way to overcome these two issues?