05-01-2016 11:27 AM
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
Solved! Go to Solution.
05-01-2016 12:01 PM - edited 05-01-2016 12:03 PM
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).
05-01-2016 12:20 PM - edited 05-01-2016 12:20 PM
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)
05-01-2016 12:59 PM
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
05-01-2016 01:36 PM
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
05-01-2016 04:16 PM
05-01-2016 10:27 PM
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
05-02-2016 01:10 AM
Do you have an estimate on the error in the Y data?
05-02-2016 01:57 AM
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?
05-02-2016 10:36 AM
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.