- Timestamp:
- 02/05/15 16:09:10 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Analysis/3.3/Statistics/Fitting
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/Statistics/Fitting/ExpFitting.cs
r11913 r11914 25 25 namespace HeuristicLab.Analysis.Statistics { 26 26 public class ExpFitting : IFitting { 27 private void LogFunc(double[] c, double[] x, ref double func, object obj) {27 private void ExpFunc(double[] c, double[] x, ref double func, object obj) { 28 28 func = Math.Exp(-c[0] * Math.Pow(x[0], 2)); 29 29 } … … 34 34 } 35 35 36 public void Calculate(double[] dataPoints, out double p0 , out double p1) {36 public void Calculate(double[] dataPoints, out double p0) { 37 37 var stdX = GetDefaultXValues(dataPoints.Count()); 38 Calculate(dataPoints, stdX, out p0 , out p1);38 Calculate(dataPoints, stdX, out p0); 39 39 } 40 40 41 public void Calculate(double[] y, double[] x, out double p0 , out double p1) {41 public void Calculate(double[] y, double[] x, out double p0) { 42 42 if (y.Count() != x.Count()) { 43 43 throw new ArgumentException("The lenght of x and y needs do be equal. "); … … 60 60 alglib.lsfitcreatef(xx, y, c, diffstep, out state); 61 61 alglib.lsfitsetcond(state, epsf, epsx, maxits); 62 alglib.lsfitfit(state, LogFunc, null, null);62 alglib.lsfitfit(state, ExpFunc, null, null); 63 63 alglib.lsfitresults(state, out info, out c, out rep); 64 64 65 65 p0 = c[0]; 66 p1 = c[0];67 66 } 68 67 69 public DataRow CalculateFittedLine(double[] dataPoints , string rowName) {70 DataRow newRow = new DataRow( rowName);71 double c0 , c1;72 Calculate(dataPoints, out c0 , out c1);68 public DataRow CalculateFittedLine(double[] dataPoints) { 69 DataRow newRow = new DataRow(); 70 double c0; 71 Calculate(dataPoints, out c0); 73 72 var stdX = GetDefaultXValues(dataPoints.Count()); 74 73 … … 80 79 } 81 80 82 public DataRow CalculateFittedLine(double[] y, double[] x , string rowName) {83 DataRow newRow = new DataRow( rowName);84 double c0 , c1;85 Calculate(y, x, out c0 , out c1);81 public DataRow CalculateFittedLine(double[] y, double[] x) { 82 DataRow newRow = new DataRow(); 83 double c0; 84 Calculate(y, x, out c0); 86 85 87 86 for (int i = 0; i < x.Count(); i++) {
Note: See TracChangeset
for help on using the changeset viewer.