01-14-2025 07:06 PM
@TheWolfmansBrother wrote:
They provided a .txt delimited file in a previous post. Thanks for your input.
Obviously, the OP Wants a double exponential with an offset (T1, T2, A1, A2, Y0), so we would need a general nonlinear model.
For the single exponential fit you did, here's a slightly simpler version (Assuming X is sorted)
(I did not understand the bottom part of your code)
01-16-2025 08:23 AM - edited 01-16-2025 08:37 AM
run "CodeMadnessFitting2010\FitCurveSelect.vi" (labview 2020) from attached .zip file
it looks like the simple expontial fit is almost as good - in terms of residues - as the double expontial fit, if the data is constrained to >=y0, and y0 is found as the global maximum in samples.txt
01-20-2025 02:03 AM
I’ve recently started learning LabVIEW, and all the answers seem difficult. I tried to simplify it, but it still feels challenging. What else should I do here?
01-21-2025 02:13 AM
@dlehdgh20 wrote:
I’ve recently started learning LabVIEW, and all the answers seem difficult. I tried to simplify it, but it still feels challenging. What else should I do here?
Does it work?
01-23-2025 07:53 AM - edited 01-23-2025 08:02 AM
@dlehdgh20 wrote:
I’ve recently started learning LabVIEW, and all the answers seem difficult. I tried to simplify it, but it still feels challenging. What else should I do here?
You told us in Message 3,that you want to fit only the x,y data points withs positive values
The best way to prepare your data is to use altenbach's suggestion from Message 11
also, messages 3 reveales an initial guess for {offset, amplitude1, tau1, amplitude2, tau2} which works fine if the datapoints to fit are limited accordingly.
01-24-2025 04:14 AM
Is it possible to automatically set the initial guess in LabVIEW?
01-24-2025 08:44 AM
@dlehdgh20 wrote:
Is it possible to automatically set the initial guess in LabVIEW?
Yes.
01-24-2025 10:11 AM - edited 01-24-2025 10:14 AM
@altenbach wrote:
@dlehdgh20 wrote:
Is it possible to automatically set the initial guess in LabVIEW?
Yes.
Now that I am on a computer, here are a few more details.
You know the model, so you know how many parameters you need to guess. They just need to be reasonable and can be quite a bit off. For example the last data point is probably a reasonable guess for the offset while the difference between the first and last point is a good guess for the sum of amplitudes, so split that 50/50 for the two components. For the two damping factors, look at the times where the data drops to e.g. 30% and 60% and go from there. Most likely the fit will converge quickly.
(Bad guesses would be if the amplitudes has the wrong sign or if you set both damping to the same guess. All this assume that the data is reasonable. i.e. that you actually have data covering the important curve features. If you only have data form the first 20% of the drop, it will be impossible to extract reliable parameters no matter what the guess is, unless you have simulated data with absolutely no noise. If one of the amplitudes is nearly zero after the fit or of both damping terms are very similar, go back and fit with a single exponential. You can also calculate the parameter errors from the covariance matrix and the data noise. If a parameter has very large error, it means that the model is not suitable for the data)
01-30-2025 08:56 AM
@dlehdgh20 wrote:
Is it possible to automatically set the initial guess in LabVIEW?
for curiosity, I tried to initialize with random values, and the regression will converge to a usuful result. apperently.
init | best |
|
|
01-30-2025 11:43 AM - edited 01-30-2025 11:44 AM
@alexderjuengere wrote:
@dlehdgh20 wrote:
Is it possible to automatically set the initial guess in LabVIEW?
for curiosity, I tried to initialize with random values, and the regression will converge to a usuful result. apperently.
Yes, the algorithm is quite good and forgiving. Good initial values still shorten the convergence AND increase the success rate. It also depends on the model, some are more forgiving than others, of course.
These random values (0..1) are still very reasonable here. Try random vales in the range -1e6 to 1e6 (i.e. make the sign random).
Also, the two exponential components might switch place and it would be useful to later sort them by damping factor or amplitude if desired.