- 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.
- 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 :)
Convolution using Embedded MATLAB Function Block in simulink
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sandeep
el 17 de Mzo. de 2012
Comentada: nirali rathod
el 19 de Dic. de 2016
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
0 comentarios
Respuesta aceptada
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..
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
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!