01-29-2018 09:36 AM
Good morning,
I have to fit the attached FitCUrve.vi and finally I want to obtain the white fitted curve shown on Fit.png.
Any ideas ?
Thank you in advanced.
Luca
01-29-2018 10:10 AM
It looks like you want to smooth or average the data, to smooth out the quantization steps. A simple starting point might be a moving average filter. You can run the Y-values through a for loop with Mean PtByPt.vi inside, with a sample length of maybe 100 points, and see if that works for you.
01-29-2018 10:37 AM - edited 01-29-2018 10:41 AM
To fit a curve, you need a mathematical model that describes the behavior. What's the theory behind the observed data?
What part is interesting data and what features are unimportant artifacts?
Looks like it starts out at zero, then you get an impulse with several damped oscillations containing a couple of frequencies.
What parameters do you want to get out of all this (e.g. start time, time constants, frequencies, amplitudes, etc.)
(A plain smoothing of the data might be a bit tricky because the width of the features varies strongly with position. I assume your white curve is hand-drawn and not really the desired output. It would be almost impossible to get this because your x-values are oscillating and you often have several Y for a given X, especially on the main feature)
01-29-2018 10:48 AM
To smoth pulse shaped data I would recommend the Savitky-Golay filter.
It's a polynominal fitting 🙂
Reading the LV-help on SG-filter (and wikipedia) is also recommended 😉
01-29-2018 11:13 AM
Fitting: Extracting meaningful parameters from a curve according to a mathematical model and draw the calculated model curve.
Smoothing, filtering: Getting rid of noise cosmetically.
Originally, you were talking about fitting. Please explain the purpose of this exercise so we can give more targeted and specific suggestions.
01-29-2018 02:53 PM
@altenbach wrote:
Fitting: Extracting meaningful parameters from a curve according to a mathematical model and draw the calculated model curve.
Smoothing, filtering: Getting rid of noise cosmetically.
Originally, you were talking about fitting. Please explain the purpose of this exercise so we can give more targeted and specific suggestions.
That's one of the reasons I proposed the SG filter...
Quote from Wikipedia: (including all (and more) the buzz-words 😄 😉 )
A Savitzky–Golay filter is a digital filter that can be applied to a set of digital data points for the purpose of smoothing the data, that is, to increase the signal-to-noise ratio without greatly distorting the signal. This is achieved, in a process known as convolution, by fitting successive sub-sets of adjacent data points with a low-degree polynomial by the method of linear least squares.
But you are right altenbach, extracting meaningful parameters for a mathematical/ (I would prefer physical) model and filtering are two things.
01-31-2018 01:52 AM
Thank you very much for the suggestion. I will try because I am thinking this may be the solution for my problem.
Regards
Luca
01-31-2018 01:58 AM
Thanks Mr. Henrik,
I have tried the filter SG and at the end I am thinking it will be the best solution to smooth and fit the acquired curve with noise.
Your support is been very useful !
Regards from Italy
Luca