From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fitting Curve

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

Download All
0 Kudos
Message 1 of 8
(2,517 Views)

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.

0 Kudos
Message 2 of 8
(2,500 Views)

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)

0 Kudos
Message 3 of 8
(2,489 Views)

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 😉

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 8
(2,485 Views)

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.

0 Kudos
Message 5 of 8
(2,479 Views)

@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.

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 6 of 8
(2,462 Views)

Thank you very much for the suggestion. I will try because I am thinking this may be the solution for my problem.

Regards

Luca

0 Kudos
Message 7 of 8
(2,438 Views)

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

0 Kudos
Message 8 of 8
(2,433 Views)