Using Savitzky-Golay filter in real time simulink model
29 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vishal Shankar
el 23 de Ag. de 2017
Comentada: banusundari M
el 31 de Jul. de 2019
I want to use Savitzky-Golay filter in my simulink model. This function is available in matlab as this outputsignal=sgolayfilt(inputsignal,order of filter,window size);
The way it works is as follows from some reading in the internet: It uses least squares to regress a small window of your data onto a polynomial, then uses the polynomial to estimate the point in the center of the window. Finally the window is shifted forward by one data point and the process repeats. This continues until every point has been optimally adjusted relative to its neighbors. It works great even with noisy samples from non-periodic and non-linear sources.
I am unable to use this function in simulink. Can this be achieved in simulink using a matlab function block?
Note: I would like to generate embedded code with this,hence the need to do it in simulink.
0 comentarios
Respuesta aceptada
Sudarshan Kolar
el 28 de Ag. de 2017
Hi Vishal,
I am attaching a demo model for your reference. Hope that helps.
Note:
1. Since 'sgolayfilt' requires a vector input, the buffer block is used to collect the scalar inputs and present it as a vector to the Matlab Function block.
2. Also, the outputs are displayed using vector scope instead of normal scope.
Regards -Sudarshan
4 comentarios
DN
el 15 de Dic. de 2018
Sudarshan, I think you are missing the point in your answer....it throws an error and question clearly states for code generation
Error:
The function 'sgolayfilt' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.
Function 'MATLAB Function' (#23.33.51), line 3, column 5:
"sgolayfilt(u,3,11)"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'MATLAB Function'
Have, you considered HDL coder blocks that would be compatible, this will then easily generate into code and can be synthesised ?
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!