Login  Register

Extending user-defined equations in Fit.doFit

Posted by Barboriak, Daniel on Apr 17, 2011; 10:33pm
URL: http://imagej.273.s1.nabble.com/Extending-user-defined-equations-in-Fit-doFit-tp3684931.html

Hi All,

Adding the capability to fit user-defined equations to the macro functions is great.

One thing that would allow this to be extended further would be if the user-defined equations would recognized user-defined functions.  For example:


  x=newArray (0.8,0.82,0.84);
  y=newArray (14.8393,14.7143,14.7356);

  function tqrt(xx) {
   yy = sqrt(xx);
  return yy;
        }

  guessArray = newArray(3,5);

  Fit.logResults;
  Fit.doFit("y=a*tqrt(x)+b", x, y, guessArray);


does not work because tqrt is not recognized in the Fit.doFit line.  Is there a workaround for this?  

My plan would be to use the user-defined function to process arrays (for example, integrating a trimmed array, multiplying elements by exponentials, etc).

Thanks!

--db

Daniel Barboriak, MD
Duke University Medical Center