topic Re: Fitting transcendental equation in LabVIEW
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053317#M1162719
<BLOCKQUOTE><HR /><LI-USER login="altenbach" uid="7614"></LI-USER> wrote:<BR />
<P>Assuming the function s well behaved, you can place all terms to the right and use <STRONG>Newton-Raphson</STRONG> to find the value of I where the term is zero.</P>
<P> </P>
<P>Basically find "I" where:</P>
<P> </P>
<P>{right side equation} - I = 0</P>
<P> </P>
<P>Given all other constants. repeat for all possible V's. Graph I vs V.</P>
<P> </P>
<P>Now create a fit model model that uses this to solve for I given a V and all other parameters)</P>
<P> </P>
<P>Do you know how the function is approximately supposed to look like? What is the value for VT?</P>
<P> </P>
<P><EM>(Also watch your terminology. You problem is not the transcendental equation but the fact that you cannot solve for I. Fitting typical transcendental functions (e.g. y=e^x) is no problem.)</EM></P>
<HR /></BLOCKQUOTE>
<P> </P>
<P>You're totally right, I was confused and using that terminology was misleading. My mistake. Thanks for letting me know and thanks for taking the time.</P>Fri, 22 May 2020 22:52:09 GMTJesusIbarra2020-05-22T22:52:09ZFitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052443#M1162386
<P>Hello everybody,</P>
<P> </P>
<P>I have experimental I-V data from a solar cell in the dark (basically a diode). I would like to fit this data into the following equation to obtain the optimized parameters Rs, Rsh and J01.</P>
<P> </P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eq.PNG" style="width: 434px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267453i7523E9A816808DFD/image-size/large?v=v2&px=999" role="button" title="eq.PNG" alt="eq.PNG" /></span></P>
<P>As you can see, this is a transcendental equation and cannot be expressed as</P>
<P>I = I(V, I01, Rs, Rsh)</P>
<P> </P>
<P>Is there any curve optimization VI that could help me fit this model?</P>
<P>I believe that all the non-linear fitting VIs in Labview require the function to be non-transcendental. Is there any alternative I could use?</P>
<P> </P>
<P>Thank you very much for your help.</P>Wed, 20 May 2020 08:34:46 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052443#M1162386JesusIbarra2020-05-20T08:34:46ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052588#M1162448
<P>Is VT a parameter or constant?</P>
<P>What is the typical range for V and I?</P>
<P>What are typical values for the parameters?</P>Wed, 20 May 2020 16:40:23 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052588#M1162448altenbach2020-05-20T16:40:23ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052730#M1162496
<P>Is VT a parameter or constant?</P>
<P>What is the typical range for V and I?</P>
<P>What are typical values for the parameters?</P>
<P> </P>
<P>Hi,</P>
<P> </P>
<P>Thanks for the reply. VT is a constant.</P>
<P>Let's say that V = [-2, 2] V and I = [0, 0.045]</P>
<P>Typical values for the parameters let's say for example: I01= 50E-15 A/cm2, Rsh=800 Ohms*cm2, Rs= 4 Ohm*cm2.</P>
<P> </P>
<P> </P>Thu, 21 May 2020 01:43:23 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052730#M1162496JesusIbarra2020-05-21T01:43:23ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052839#M1162540
<P>Decades ago (I think about 4), I wrote this.</P>Thu, 21 May 2020 12:05:23 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052839#M1162540paul_cardinale2020-05-21T12:05:23ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052984#M1162594
<BLOCKQUOTE><HR /><LI-USER login="JesusIbarra" uid="652748"></LI-USER> wrote:<BR />
<P>Hello everybody,</P>
<P> </P>
<P>I have experimental I-V data from a solar cell in the dark (basically a diode). I would like to fit this data into the following equation to obtain the optimized parameters Rs, Rsh and J01.</P>
<P> </P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="eq.PNG" style="width: 434px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267453i7523E9A816808DFD/image-size/large?v=v2&px=999" role="button" title="eq.PNG" alt="eq.PNG" /></span></P>
<P>As you can see, this is a transcendental equation and cannot be expressed as</P>
<P>I = I(V, I01, Rs, Rsh)</P>
<P><STRONG><FONT color="#FF0000">Sure it can -- you just did, above (assuming Vt is a constant).</FONT></STRONG></P>
<P> </P>
<P>Is there any curve optimization VI that could help me fit this model?</P>
<P><STRONG><FONT color="#FF0000">How about "Nonlinear Curve Fit on the Mathematics/Fitting Palette?</FONT></STRONG></P>
<P>I believe that all the non-linear fitting VIs in Labview require the function to be non-transcendental. Is there any alternative I could use?</P>
<P><STRONG><FONT color="#FF0000">Your belief is erroneous. Read the Help.</FONT></STRONG></P>
<P>Thank you very much for your help.</P>
<HR /></BLOCKQUOTE>
<P>Bob Schor</P>Thu, 21 May 2020 21:51:34 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4052984#M1162594Bob_Schor2020-05-21T21:51:34ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053047#M1162615
<P>Hi, thanks for the reply.</P>
<P> </P>
<P>I apologize if I was not clear. On the right side of the equation there is I*Rs (they are separate variables). So we have I inside the exponential function and at the end of the equation as well. The equation cannot be solved for I because of the variable inside the exponential. </P>
<P>Thanks again.</P>
<P> </P>
<P>Jesus</P>
<P> </P>
<P> </P>Fri, 22 May 2020 03:45:04 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053047#M1162615JesusIbarra2020-05-22T03:45:04ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053117#M1162656
<BLOCKQUOTE><HR /><LI-USER login="JesusIbarra" uid="652748"></LI-USER> wrote:<BR />
<P>On the right side of the equation there is I*Rs (they are separate variables).</P>
<HR /></BLOCKQUOTE>
<P>Sorry, my mistake. Re-thinking ...<BR /><BR /></P>
<P>This is from a review of <U></U><U>Solving Transcendental Equations: The Chebyshev Polynomial Proxy and Other Numerical Rootfinders, Perturbation Series, and Oracles</U>, by John P. Boyd, 2014: </P>
<P> </P>
<P>"<SPAN>Transcendental equations arise in every branch of science and engineering. While most of these equations are easy to solve, some are not, and that is where this book serves as the mathematical equivalent of a skydiver's reserve parachuteâ€”not always needed, but indispensible when it is. The author's goal is to teach the art of finding the root of a single algebraic equation or a pair of such equations."</SPAN></P>
<P> </P>
<P>There are clearly methods to do what you are asking, but you are correct, it is considerably more difficult (and highly specialized) that it might be "reasonable" to expect that most Programming Languages would not have built-in routines for doing this task.</P>
<P> </P>
<P>The most sophisticated "M" (as in "Mathematics", including Mathematica, MathCad, Maple, and Matlab) with which I have some experience is Mathematica, which has some discussion of this topic. You might find some useful information on the Web -- search for Transcendental Equation Mathematica.</P>
<P> </P>
<P>Bob Schor</P>Fri, 22 May 2020 12:06:52 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053117#M1162656Bob_Schor2020-05-22T12:06:52ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053200#M1162693
<P>Assuming the function s well behaved, you can place all terms to the right and use <STRONG>Newton-Raphson</STRONG> to find the value of I where the term is zero.</P>
<P> </P>
<P>Basically find "I" where:</P>
<P> </P>
<P>{right side equation} - I = 0</P>
<P> </P>
<P>Given all other constants. repeat for all possible V's. Graph I vs V.</P>
<P> </P>
<P>Now create a fit model model that uses this to solve for I given a V and all other parameters)</P>
<P> </P>
<P>Do you know how the function is approximately supposed to look like? What is the value for VT?</P>
<P> </P>
<P><EM>(Also watch your terminology. You problem is not the transcendental equation but the fact that you cannot solve for I. Fitting typical transcendental functions (e.g. y=e^x) is no problem.)</EM></P>Fri, 22 May 2020 17:00:42 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053200#M1162693altenbach2020-05-22T17:00:42ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053202#M1162694
<P>I think it is possible to sidestep the transcendental part of this problem entirely. As I understand it you are not trying to solve for x if given y, or y if given x. You are trying to find the parameters of the model that best fit your equation. So perhaps rearrange your equation slightly by subtracting I from both sides and call the left side Y, recognizing that Y should always be zero:</P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Solar Eqn.png" style="width: 366px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267604i472CECED0AEAEC8D/image-dimensions/366x92?v=v2" width="366" height="92" role="button" title="Solar Eqn.png" alt="Solar Eqn.png" /></span></P>
<P> </P>
<P>Now treat this as your model for curve fitting. You will have an array of Y values that are all 0. I and V are treated as your X input to the Nonlinear Curve Fit.vi</P>
<P>Nonlinear curve fit.vi only allows a 1D array of values for X and Y, but does not check to make sure they are the same length (Thanks Christian!!!), so this allows you to concatenate your V and I arrays into a single "X" array. Below is a snippet that shows what I mean.</P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Solar model fit.png" style="width: 575px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267605i4DDE0FDE1A42A8F1/image-size/large?v=v2&px=999" role="button" title="Solar model fit.png" alt="Solar model fit.png" /></span></P>
<P> </P>
<P>Now your model must unpack the X array so you can evaluate your model.</P>
<P> </P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="solar model.png" style="width: 845px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267606i5DF5B5B9B6141A3E/image-size/large?v=v2&px=999" role="button" title="solar model.png" alt="solar model.png" /></span></P>
<P> </P>
<P> </P>
<P>So the nonlinear curve fit will adjust the model parameters to make the model as close as possible to the Y values which are 0. This is the same way that we solve for a best fit circle or ellipse using Nonlinear Curve Fit. Ellipse fit is a shipping example (...\examples\Mathematics\Fitting\Ellipse fit.vi), but the code is a bit harder to read and the modeling aspect of the problem is not explicitly called out.</P>
<P> </P>
<P>-Jim</P>
<P> </P>
<P> </P>Fri, 22 May 2020 17:04:56 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053202#M1162694DSPGuy2020-05-22T17:04:56ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053213#M1162696
<BLOCKQUOTE><HR /><LI-USER login="DSPGuy" uid="2777"></LI-USER> wrote:<BR />
<P>So perhaps rearrange your equation slightly by subtracting I from both sides and call the left side Y, recognizing that Y should always be zero:</P>
<P> </P>
<HR /></BLOCKQUOTE>
<P>While that will give the best fit parameters, there is still the difficulty of graphing the original data and the corresponding fit on an "I vs. V" XY graph. For that we can still use my suggestion above.</P>
<P> </P>
<P>On a side note, I would simplify some of the details (fewer primitives and coercions). I doubt there is a noticeable performance penalty. In most cases, we don't even need the FOR loop in the model, of course.</P>
<P> </P>
<P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="altenbach_0-1590169588584.png" style="width: 999px;"><img src="https://forums.ni.com/t5/image/serverpage/image-id/267613iCF080D9FAECF1B95/image-size/large?v=v2&px=999" role="button" title="altenbach_0-1590169588584.png" alt="altenbach_0-1590169588584.png" /></span></P>
<P> </P>Fri, 22 May 2020 17:49:25 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053213#M1162696altenbach2020-05-22T17:49:25ZRe: Fitting transcendental equation
https://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053317#M1162719
<BLOCKQUOTE><HR /><LI-USER login="altenbach" uid="7614"></LI-USER> wrote:<BR />
<P>Assuming the function s well behaved, you can place all terms to the right and use <STRONG>Newton-Raphson</STRONG> to find the value of I where the term is zero.</P>
<P> </P>
<P>Basically find "I" where:</P>
<P> </P>
<P>{right side equation} - I = 0</P>
<P> </P>
<P>Given all other constants. repeat for all possible V's. Graph I vs V.</P>
<P> </P>
<P>Now create a fit model model that uses this to solve for I given a V and all other parameters)</P>
<P> </P>
<P>Do you know how the function is approximately supposed to look like? What is the value for VT?</P>
<P> </P>
<P><EM>(Also watch your terminology. You problem is not the transcendental equation but the fact that you cannot solve for I. Fitting typical transcendental functions (e.g. y=e^x) is no problem.)</EM></P>
<HR /></BLOCKQUOTE>
<P> </P>
<P>You're totally right, I was confused and using that terminology was misleading. My mistake. Thanks for letting me know and thanks for taking the time.</P>Fri, 22 May 2020 22:52:09 GMThttps://forums.ni.com/t5/LabVIEW/Fitting-transcendental-equation/m-p/4053317#M1162719JesusIbarra2020-05-22T22:52:09Z