I'm trying to do simple averaging in Simulink and need some help with it.
Mostrar comentarios más antiguos
Assume AI'm acquiring a noisy signal at 1 mS interval and I want to get 1 point every 50 mS. I would like to collect the data for the 50 mS and spit out an average for logging. I'm not sure how to do it.
Any simple solutions would be appreciated.
Respuesta aceptada
Más respuestas (4)
Fangjun Jiang
el 9 de Nov. de 2011
0 votos
Use the "Weighted Moving Average" block from Simulink>Discrete, click help for details.
2 comentarios
Guillermo
el 9 de Nov. de 2011
Fangjun Jiang
el 9 de Nov. de 2011
Hah, it is obsolete! http://www.mathworks.com/help/toolbox/simulink/ref_obsolete_blocks/weightedmovingaverageobsolete.html
Use the new Discrete FIR Filter, http://www.mathworks.com/help/toolbox/simulink/slref/discretefirfilter.html
Walter Roberson
el 9 de Nov. de 2011
0 votos
Feed the signal in to an integration block that is reset to 0 every 50 samples; take the 50th output and divide it by 50 to get the average for that period.
There might be a cleaner way to only trigger the output collection every 50 outputs and tie that in to the integration block being cleared right afterwards.
1 comentario
Guillermo
el 9 de Nov. de 2011
Guillermo
el 9 de Nov. de 2011
Martin Murtagh
el 23 de Mzo. de 2021
0 votos

I have replaced the moving average block in my models with the subsystem shown. By setting the delay length to the moving average value divided by the time-step and the gain value to one over the moving average value, this subsystem will calcuate the moving average in the same way as the moving average function with a sliding window.
Categorías
Más información sobre Signal Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!