| Electronics > Projects, Designs, and Technical Stuff |
| Curve fitting question |
| << < (4/8) > >> |
| Henrik_V:
Overseen the relative part... so +1 for golden_labels fitting: https://xkcd.com/2048/ For a meaningful correction much more information is needed. Are different ranges involved? (Should have individual LUTs) Repeatability? Stability/Drift? Systematic errors (loaded voltage divider?)? |
| iMo:
--- Quote from: Jester on March 06, 2019, 12:34:03 pm ---The uncorrected data and graph can be seen here (correction only at zero and full-scale): --- End quote --- What are the Vdisp values at Vin=65 or 76 or 44? You do not know. It could be anything. You have to live with an error and you may fit with a polynomial such the resulting error will still be acceptable. |
| mjkuwp:
It will help if you can post actual data in a text file rather than an image. I suspect that the odd 'shape' of the curve is not real it is noise in the instrument and you would not want to try to calibrate this out. A 2nd or 3rd order curve may be enough. Do you have multiple samples of this data? Or, could you take 10 samples at each reference point, average these and use those as the inputs to the calibration. For something like this I would use either Python with numpy and matplotlib or EXCEL or even Google Sheets ( part of Google Docs) in Google Sheets you would use Charts to make a Scatter plot and then add a trendline to a series and select the option for the Label of that trendline to show the equation. |
| Jester:
--- Quote from: Conrad Hoffman on March 06, 2019, 06:04:50 pm ---Wealth of stuff here you might try- http://zunzun.com/ --- End quote --- Thanks for the link, this in an excellent tool. I ended up breaking the data into a few ranges and then applying correction factor per range. Displayed error is now < +/- 0.1% from 0-250V, and that's good enough for this project. I still need to test over temperature range and will add an additional tweak factor to compensate if needed. :) :-+ |
| Jester:
--- Quote from: rs20 on March 07, 2019, 08:34:08 am ---A Lagrange polynomial is a HORRIBLE idea in this context because the resulting polynomial will take a circuitous path to travel through every point precisely, no matter how ridiculous the resulting values between the given points are: The ONLY time to use Lagrange polynomials is if you absolutely must have a polynomial curve that goes precisely through all your points, and absolutely literally couldn't care less what the rest of the values are. --- End quote --- Good point, and I observed what you described when I tried that approach. |
| Navigation |
| Message Index |
| Next page |
| Previous page |