topic Re: non-linear sigmoid curve fitting in LabVIEW
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1709236#M603840
<P>Thanks for your help. I didn't notice the sign of b. How can I get the resulting values out? The "non-linear coefficients" output only give X0 but not the others. I want to be able to get a corresponding X value on the curve from putting in a Y value. I was thinking of solving the model formula with the resulting values from the curve fit in order to do this. Is there an easier way?</P>
<P> </P>
<P>Thanks again.</P>Sun, 18 Sep 2011 03:48:16 GMTratkindler2011-09-18T03:48:16Znon-linear sigmoid curve fitting
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1702548#M602496
<P>I'm trying to do some non-linear curve fitting to a sigmoid equation using the Curve Fitting Express vi but I can't seem to get it working. I'm a novice to curve fitting, but I was able to get a nice fit using the graphing program SigmaPlot and I'm trying to copy that in Labview. The Curve Fitting Express vi seems to parse the equation from SigmaPlot ok but I can't get it to do a fit. I've tried varying the inital parameter values a lot - including those found by SigmaPlot - but it won't do the fit. I've attached screen caps of the Labview vi as well as the SigmaPlot output. Any suggestions appreciated.</P>
<P> </P>
<P>The sample data set:</P>
<P>X Y</P>
<P>1 66<BR />2 76<BR />3 80<BR />4 82<BR />5 102<BR />6 101<BR />7 31<BR />8 48<BR />9 0<BR />10 0<BR />11 1<BR />12 1<BR />13 1<BR />14 1<BR />15 1<BR />16 13</P>
<P> </P>
<P>SigmaPlot Report:</P>
<P> </P>
<P>Nonlinear Regression </P>
<P>Data Source: Data 1 in Notebook1<BR />Equation: Sigmoidal, Sigmoid, 3 Parameter <BR />f= a/(1+exp(-(x-x0)/b))</P>
<P>R Rsqr Adj Rsqr Standard Error of Estimate</P>
<P>0.9415 0.8865 0.8690 14.6281 </P>
<P> Coefficient Std. Error t P </P>
<P>a 83.2690 6.7702 12.2993 <0.0001 <BR />b -0.6582 0.3302 -1.9935 0.0676 <BR />x0 7.5787 0.3848 19.6954 <0.0001 </P>
<P>Analysis of Variance:</P>
<P>Analysis of Variance: <BR /> DF SS MS <BR />Regression 3 44518.2282 14839.4094 <BR />Residual 13 2781.7718 213.9824 <BR />Total 16 47300.0000 2956.2500 </P>
<P>Corrected for the mean of the observations:<BR /> DF SS MS F P <BR />Regression 2 21717.2282 10858.6141 50.7453 <0.0001 <BR />Residual 13 2781.7718 213.9824 <BR />Total 15 24499.0000 1633.2667 </P>
<P>Statistical Tests:</P>
<P>Normality Test (Shapiro-Wilk) Passed (P = 0.3040)</P>
<P>W Statistic= 0.9361 Significance Level = 0.0500</P>
<P>Constant Variance Test Passed (P = 0.1360)</P>
<P>Fit Equation Description:<BR />[Variables]<BR />x = data(1,size(col(1)))<BR />y = col(1)<BR />reciprocal_y = 1/abs(y)<BR />reciprocal_ysquare = 1/y^2<BR />'Automatic Initial Parameter Estimate Functions<BR />sup(q)=if(mean(q)>=0, max(q), min(q))<BR />b1(q,r)=if(sup(r)>0, xwtr(q,r,.5)/4, -xwtr(q,r,.5)/4)<BR />[Parameters]<BR />a = sup(y) ''Auto {{previous: 83.269}}<BR />b = if(b1(x,y)=0, 1, b1(x,y)) ''Auto {{previous: -0.658229}}<BR />x0 = x50(x,y,.5) ''Auto {{previous: 7.57868}}<BR />[Equation]<BR />f= a/(1+exp(-(x-x0)/b))<BR />fit f to y<BR />''fit f to y with weight reciprocal_y<BR />''fit f to y with weight reciprocal_ysquare<BR />[Constraints]<BR />[Options]<BR />tolerance=1e-10<BR />stepsize=1<BR />iterations=20</P>
<P>Number of Iterations Performed = 15</P>
<P> </P>
<P> </P>Mon, 12 Sep 2011 23:34:34 GMThttps://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1702548#M602496ratkindler2011-09-12T23:34:34ZRe: non-linear sigmoid curve fitting
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1702552#M602497
<P>I forgot to attach the block diagram...</P>Mon, 12 Sep 2011 23:49:17 GMThttps://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1702552#M602497ratkindler2011-09-12T23:49:17ZRe: non-linear sigmoid curve fitting
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1704416#M602883
<P>Hi,</P>
<P> </P>
<P>I've set up the vi using your data, and it seems to me that the trick to getting LabVIEW to do the fit correctly is having the signs of the guesses correct. I was able to get the fit you had in your other code using the guesses of a=0, b=-1, x0=0. I noticed in the screen shot you posted that you were using a positive b guess. If you are still having trouble getting it to do the fit, you might also try rewriting your equation so that all of the variables are positive in the correct fit.</P>
<P> </P>
<P>I hope this helps,</P>
<P> </P>
<P>Regards,</P>
<P>Luke B.</P>Wed, 14 Sep 2011 04:23:35 GMThttps://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1704416#M602883Luke_B2011-09-14T04:23:35ZRe: non-linear sigmoid curve fitting
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1709236#M603840
<P>Thanks for your help. I didn't notice the sign of b. How can I get the resulting values out? The "non-linear coefficients" output only give X0 but not the others. I want to be able to get a corresponding X value on the curve from putting in a Y value. I was thinking of solving the model formula with the resulting values from the curve fit in order to do this. Is there an easier way?</P>
<P> </P>
<P>Thanks again.</P>Sun, 18 Sep 2011 03:48:16 GMThttps://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1709236#M603840ratkindler2011-09-18T03:48:16ZRe: non-linear sigmoid curve fitting
https://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1709240#M603842
<P>Connect a numeric <U>array</U> instead of a scalar to the output. <span class="lia-unicode-emoji" title=":winking_face:">😉</span></P>Sun, 18 Sep 2011 04:24:59 GMThttps://forums.ni.com/t5/LabVIEW/non-linear-sigmoid-curve-fitting/m-p/1709240#M603842altenbach2011-09-18T04:24:59Z