LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt with the fitting curve: initial and final conditions

Solved!
Go to solution

Hello Labview community. 

 

In a program I am using a third-degree polynomial interpolation, but I need that this interpolation to start and end at zero. Is this possible? Is there any interpolation function that allows the start and end of the interpolated curve to be conditioned?
 
Attached i show and image with my problem. 
 
Thanks in advance. 
 
Regards. 
0 Kudos
Message 1 of 7
(1,974 Views)

Not if you use a 3rd order polynomial. You data does not look at all like the fit, so what's the purpose of all this? You can always fit to an arbitrary nonlinear model that has the desired limiting conditions.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 7
(1,969 Views)

Altenbach thanks for the reply. We need to know the trend of the curve for later calculations so we use a polynomial of third order, because for the great majority of data this function is correct. I attached you a ".vi" so you can see an example of signals that I am processing. In each of them I have added the best interpolation from my point of view.

I would like to try to solve two problems:

- The first one if is posible obtain an automatically approximate the best possible curve. I do not know what parameter I can control to make a decision.

- The beginning and end of the approximate curves must have an identical value to the original signals, I mean in curve 1 the beginning and end of the approximate curve are almost identical, in the two although the curve is well adjusted the start and are far from the original values.
 
- May be with a non linear fit?

Any ideas for the two problems?

Thank you very much Altenbach.
0 Kudos
Message 3 of 7
(1,919 Views)

As a first step, stop using express VIs, they are clunky. Use general polynomial fit. You also don't need all that duplicate code. Use a single instance of the code and a FOR loop.

 

There is a "weight" input, so all you need to do is give the first and last point a much higher weight and the algorithm will try to force the fitted curve closer through these points, at the expense of the other points.

 

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 4 of 7
(1,904 Views)

Thanks Altenbach,

 

I have modified the code by simplifying it for the moment to a single signal. I have modified the code with the general polynomial fit function. I do not get any kind of approximation to the input curve. I have generated a Weight array of the same size as Y and I can enter the values of the first and last position of the array as well as the other values (all the same).

Can you check where the problem is that I do not get any approximation curve?
Thanks another time. 
0 Kudos
Message 5 of 7
(1,897 Views)

Sorry, 

I forgot to enter an X array. Now if I get the curve, I'll see how it works with all the signals and validate the answer.

Thank you.
0 Kudos
Message 6 of 7
(1,892 Views)
Solution
Accepted by topic author Gabrielo

You have a couple of bugs, for example the last element has index N-1, not N. You are not modifying the right side of the weight array at all.

 

Here's what I had in mind. Seems to work quite well.

 

If you want the edge points even closer to the data, increase their weight even more (e.g. 1M).

 

 

PolyFitForceEdge.png

 

 

PolyFitForceEdgeFP.png


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 7 of 7
(1,880 Views)