Convolution using Embedded MATLAB Function Block in simulink

2 visualizaciones (últimos 30 días)
hi..
i am trying to implement an Embedded MATLAB Function Block in Simulink which can be used to convolute a given sampled input with a coefficient array h[]. but it seems like I am stuck at the very beginning. I cannot figure out how to store sufficient values of input in a buffer so that they can be convoluted with the coefficient array
p.s. i know this can be done very easily in signal processing toolbox but i am supposed to do it in Simulink

Respuesta aceptada

Jarrod Rivituso
Jarrod Rivituso el 17 de Mzo. de 2012
To do this, somewhere in your model you need to have a block that maintains the previous values of the sampled input (the convolution window) so that the "MATLAB Function" block (formerly known as the "Embedded MATLAB Function" block) can do the convolution over the entire convolution window.
You have two main options..
  1. Use one of the built-in blocks to do this. For instance, in basic Simulink there is the Tapped Delay block in the Discrete library. In the DSP System Toolbox library, there are more sophisticated buffer blocks that give you many more options (though it sounds like for some reason you cannot use those). Then, you can pass the output of these blocks to your MATLAB Function block and the input will be a vector that you can then use for the convolution.
  2. Use persistent variables in the MATLAB Function block to maintain the state of the convolution window within the MATLAB Function block itself. This would require more coding to shift the values of the window manually, but maybe you're into that :)
I'm no signal processing expert, so if someone wants to correct my language a bit then please do :) Also, I know that once you start going from a sampled signal to a more frame-based signal, there are a few of other design choices to consider, such as the window size and what the sample time of the frame-based signal should be.
Hope this helps!
  2 comentarios
Sandeep
Sandeep el 18 de Mzo. de 2012
thank you very much..
nirali rathod
nirali rathod el 19 de Dic. de 2016
can we store those input elements in form of array?

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by