MATLAB Answers


Interpolating random values to smoothen a curve

Asked by Abhiraj Gupta on 22 Jul 2019
Latest activity Commented on by TADA
on 23 Jul 2019
I need to smoothen curve on this graph and remove the noise in it.I can either use interpolation or curve fitting. I am not able to do it using curve fitting toolbox.How can I do it..??

  1 Comment

Please do share the code. so that members can try on it.

Sign in to comment.

1 Answer

Answer by TADA
on 22 Jul 2019
 Accepted Answer

you can implement the stavisky golay filter
basically the idea is to iterate through the data and on each point perform a polynomial fit on a window of several data points arround it, then each point is reoplaced with the value of the polynomial fit in that same point.


Thank you !
framelen =3;
for i=1:100
y = sgolayfilt(data,order,framelen);
y = sgolayfilt(y,order,framelen);
this is giving perfect and smooth curve
In that code you apply the smoothing 100 times on the entire data
This is very intense and it will probably damage your signal
I would apply the smoothing once, but I would use a larger frame
I would also use a higher order fit

Sign in to comment.