.lsfit.poly
changeset 42 22f5d5d35236
parent 36 04e8cb4f8073
equal deleted inserted replaced
41:fa41b3a72c97 42:22f5d5d35236
     1 #======================================================================
     1 #======================================================================
     2 #                    . L S F I T . P O L Y 
     2 #                    . L S F I T . P O L Y 
     3 #                    doc: Wed Feb 24 09:40:06 1999
     3 #                    doc: Wed Feb 24 09:40:06 1999
     4 #                    dlm: Sun May 13 08:25:37 2018
     4 #                    dlm: Mon May 11 11:54:03 2020
     5 #                    (c) 1999 A.M. Thurnherr
     5 #                    (c) 1999 A.M. Thurnherr
     6 #                    uE-Info: 114 36 NIL 0 0 72 2 2 4 NIL ofnI
     6 #                    uE-Info: 31 55 NIL 0 0 72 2 2 4 NIL ofnI
     7 #======================================================================
     7 #======================================================================
     8 
     8 
     9 # What you need to provide if you wanna fit a different
     9 # What you need to provide if you wanna fit a different
    10 # linear model function to your data:
    10 # linear model function to your data:
    11 #	- a number of global variables to be set during loading
    11 #	- a number of global variables to be set during loading
    26 #	Jul 12, 2004: - made poly-order argument into -o option
    26 #	Jul 12, 2004: - made poly-order argument into -o option
    27 #	Jul 28, 2006: - Version 3.3 [HISTORY]
    27 #	Jul 28, 2006: - Version 3.3 [HISTORY]
    28 #	Sep 19, 2011: - moved part of the usage code into init() to allow use in [pgram]
    28 #	Sep 19, 2011: - moved part of the usage code into init() to allow use in [pgram]
    29 #	Jan 10, 2013: - added extremum output when fitting parabola (-o 2)
    29 #	Jan 10, 2013: - added extremum output when fitting parabola (-o 2)
    30 #	May 13, 2018: - BUG: replaced opt_o with modelNFit in &modelCleanup()
    30 #	May 13, 2018: - BUG: replaced opt_o with modelNFit in &modelCleanup()
       
    31 #	May 11, 2020: - increased extremum output precision
    31 
    32 
    32 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    33 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    33 #
    34 #
    34 # THE FOLLOWING VARIABLES MUST BE SET GLOBALLY (i.e. during loading)
    35 # THE FOLLOWING VARIABLES MUST BE SET GLOBALLY (i.e. during loading)
    35 #
    36 #
   113 {
   114 {
   114 	return unless ($0 eq 'lsfit' && $modelNFit == 3);		# calculate loc of extremum on parabolic fits with lsfit only
   115 	return unless ($0 eq 'lsfit' && $modelNFit == 3);		# calculate loc of extremum on parabolic fits with lsfit only
   115 
   116 
   116 	my($extX) = -$A[2] / (2 * $A[3]);
   117 	my($extX) = -$A[2] / (2 * $A[3]);
   117 	if ($A[3] > 0) {
   118 	if ($A[3] > 0) {
   118 		&antsInfo(".lsfit.poly: minimum at %.1f",$extX);
   119 		&antsInfo(".lsfit.poly: minimum at %g",$extX);
   119 	} elsif ($A[3] < 0) {
   120 	} elsif ($A[3] < 0) {
   120 		&antsInfo(".lsfit.poly: maximum at %.1f",$extX);
   121 		&antsInfo(".lsfit.poly: maximum at %g",$extX);
   121 	} else {
   122 	} else {
   122 		&antsInfo(".lsfit.poly: saddle point at %.1f",$extX);
   123 		&antsInfo(".lsfit.poly: saddle point at %g",$extX);
   123 	}
   124 	}
   124 }
   125 }
   125 
   126 
   126 1;
   127 1;