# LabVIEW

cancel
Showing results 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 ?

Luca

Message 1 of 8
(2,322 Views)

## Re: Fitting Curve

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.

Message 2 of 8
(2,305 Views)

## Re: Fitting Curve

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)

Message 3 of 8
(2,294 Views)

## Re: Fitting Curve

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 ǝɥʇ'

Message 4 of 8
(2,290 Views)

## Re: Fitting Curve

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.

Message 5 of 8
(2,284 Views)

## Re: Fitting Curve

@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 ǝɥʇ'

Message 6 of 8
(2,267 Views)

## Re: Fitting Curve

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

Regards

Luca

Message 7 of 8
(2,243 Views)

## Re: Fitting Curve

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

Message 8 of 8
(2,238 Views)