julfit(3f) - [M_math:fit] linear least squares curve fits, destroys input arrays
Synopsis
Description
Options
Returns
subroutine julfit(x,y,ixn,itype,a,b,r2)
integer,intent(in) :: ixn real :: x(ixn),y(ixn) integer,intent(in) :: itype real,intent(out) :: a,b,r2
use method of least squares to find a fit to the data. the expression being fitted is of one of several forms that have in common the fact that the expression will plot as a straight line if the proper axis type is selected.
type x-axis y-axis significance of a and b1 linear linear y=a*x+b # linear function 2 linear log y=a*b**x # exponential function 3 log linear y=a*log10(x)+b # logarithmic function 4 log log y=a*x**b # power functions: hyperbolic if b <0; parabolic if b > 0. 5 linear log y=a*e**(-b*x) # a common variant of the exponential form.
x array of x values, input y array of y values, input that are changed to hold the output ixn number of points in arrays x and y to use itype expression being solved
1. Y=a*X+b 2. Y=a*b**X 3. Y=a*log10(X)+b 4. Y=a*X**b 5. Y=a*e*(-b**X)
NOTE: odd use of arrays specifically optimized for calling from USH
RETURNS
a slope of linearized line b y intercept of linearized line r2 correlation coefficient (1=perfect) In general, if the correlation coefficient is <0.5 the correlation is regarded as insignificant. If it is >0.8 the derived linear fit is considered highly significant.
Nemo Release 3.1 | julfit (3) | February 23, 2025 |