- 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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sandeep
il 17 Mar 2012
Commentato: nirali rathod
il 19 Dic 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 Commenti
Risposta accettata
Jarrod Rivituso
il 17 Mar 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 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!