LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

polynomial fit

Solved!
Go to solution

Hey Guys,

 

Need some help here.

 

I am doing a polynomial Fit (order 10) for my project. the fit is done between Di-electric Constant and Frequency. I did the fitting with an Express Fit block and I exported the graph values to excel. The fit was very accurate and the fitted values were very close to the values that I observed.

 

I tried implementing the polynomial equation into a formula node and checking the values in real time by changing my independent variable (x) (Di - Electric Constant). When i change the input with a control, that should match the values exported from the best fit graph(obtained from the poly fit block) right ?

 

I tried changing my Di - electric values from 1.4 to 5.. Till a value of 3, the output of the formula node was close to the values exported from the best fit graph. After 3, the values that I obtain from my formula node are very far away from the observed reading...

 

What is the reason behind this ?

 

Thanks in advance for your help 😄 

 

Attached are the VI's and the excel file for your reference.

 

Hari

Download All
0 Kudos
Message 1 of 10
(5,103 Views)

I don't see any fomula node. Do you have problems with fitting or with the polynominal evaluation.

 

I recomment to make things 90% simpler. Just use the plain polynomial fit from the ftting palette and then use polynomial evaluation to calculate the function based on the coefficients. Also use a lower polynomial order. A 10th orde polynomial can blow up for certain data.

 

(no need for opaque dynamic data and express VIs).

0 Kudos
Message 2 of 10
(5,093 Views)
Solution
Accepted by topic author Hariharan0304

Here's a quick draft. Maybe it can give you some ideas...

 

(Of course the fit only needs to be redone if the data or order changes, so this is quite crude at the moment)

Message 3 of 10
(5,085 Views)

Hello,

 

Thanks a lot for your help 😄 

 

Order 5 is pretty good for the fit...Do you have any tips on how to choose the order for a given data ?

 

Hari 

0 Kudos
Message 4 of 10
(5,072 Views)

As a practical matter, choose the lowest order which gives good results. Polynomials always go toward infinity as the independent variable gets large. Higher order polynomials may have large variations for independent variable values between the ones used to find the fit and very often will move quickly away from the data outside the range of the fitted data.

 

The best way select the order is to use theoretical knowledge of the process which generates the data. If you know how the the dielectric constant is expected to vary with frequency for the material you are testing, use the function predicted by theory for the fit. Since dielectric constants do not go to infinity and tend to vary slowly with frequency for many materials, a low order polynomial or some other type of function seems likely to be an appropriate choice.

 

Lynn

 

 

0 Kudos
Message 5 of 10
(5,057 Views)
In your case if e.g. x=9, 9^0 and 9^10 would differ by many, many orders of magnitude, making the problem ill-posed and no longer suitable for the standard algorithms used by the tool.
0 Kudos
Message 6 of 10
(5,030 Views)

Hello,

 

 

What order of polynomial fit should I choose for the below attached values in the VI ? or should I go for a different type of fit ?

 

Thanks 🙂 

 

Hari

0 Kudos
Message 7 of 10
(5,007 Views)

Do you have an estimate on the error in the Y data?

0 Kudos
Message 8 of 10
(4,986 Views)

What is the purpose of the polynomila fit? Just interpolation?

 

Do you have a theoretical model for the behavior? Maybe a nonlienar fit to an actual model would be more reasonable.

 

A polynomial fit here is just a mindless description of the data behavior. Of course the  fit will get better the more terms you throw at it, but that does not mean that it makes sense to use more terms. Maybe the measuremets are not as accurate as you think?

0 Kudos
Message 9 of 10
(4,974 Views)

Sometimes it is also useful to see how the polynomila behaves outside the data. Here it generates the funtion in the interval 7..10.

Also have a look at e.g. chisquare to see at which point the fit is sufficient to fit the data within error.

0 Kudos
Message 10 of 10
(4,956 Views)