Skip to content

Instantly share code, notes, and snippets.

@miura
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miura/9912494 to your computer and use it in GitHub Desktop.
Save miura/9912494 to your computer and use it in GitHub Desktop.
//Curve fitting example
// see class CurveFitter
// http://rsb.info.nih.gov/ij/developer/api/ij/measure/CurveFitter.html
// 20110412 Kota
//creat example data arrays
var xa = [1, 2, 3, 4];
var ya = [3, 3.5, 4, 4.5];
//construct a CurveFitter instance
cf = CurveFitter(xa, ya);
//actual fitting
//fit models: see http://rsb.info.nih.gov/ij/developer/api/constant-values.html#ij.measure.CurveFitter.STRAIGHT_LINE
cf.doFit(CurveFitter.STRAIGHT_LINE);
//print out fitted parameters.
IJ.log(cf.getParams()[0]+ " : " + cf.getParams()[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment