/* ************************************************************************ * fit.c: Least square fit to decay spectrum * * * * From: "A SURVEY OF COMPUTATIONAL PHYSICS" by RH Landau, MJ Paez, and CC BORDEIANU Copyright Princeton University Press, Princeton, 2008. Electronic Materials copyright: R Landau, Oregon State Univ, 2008; MJ Paez, Univ Antioquia, 2008; & CC BORDEIANU, Univ Bucharest, 2008 Support by National Science Foundation * * ************************************************************************ */ #include #include #define data 12 /* number of data points */ main() { int i, j; double s, sx, sy, sxx, sxy, delta, inter, slope; double x[data], y[data], d[data]; for (i=0; i