The attached VI exemplifies the use of Exponential Fit function to detect fails on capacitor charge and discharge curves.
The "capacitor_curve_exp_fit.vi" works as follow:
1. Read curve samples from "cap_samples.bin" file. There are 2 charging curve samples, one curve ok and another with fail;
2. Create x array to be used by exponential fit function;
3. Calculate the best exponential fit curve using Leas Square, Least Absolute Residual or Bisquare fitting methods;
4. Calculate the SSE, R-square and RMSE statistical parameters that represent how well the fitted curve matches the acquired curve;
5. Calculate the distance between each equivalent point of the fitted and acquired curve;
6. Classify as approved or rejected based in the distance limit criteria.
VI screenshots
OBS: extract "cap_samples.bin" file in the same VI folder.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.