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.