QtiPlot  0.9.8.2
ExponentialFit.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : fitclasses.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Exponential fit classes
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef EXPONENTIALFIT_H
30 #define EXPONENTIALFIT_H
31 
32 #include "Fit.h"
33 
34 class ExponentialFit : public Fit
35 {
36  Q_OBJECT
37 
38  public:
39  ExponentialFit(ApplicationWindow *parent, QwtPlotCurve *c, bool expGrowth = false);
40  ExponentialFit(ApplicationWindow *parent, QwtPlotCurve *c, double start, double end, bool expGrowth = false);
41  ExponentialFit(ApplicationWindow *parent, Graph *g, bool expGrowth = false);
42  ExponentialFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, bool expGrowth = false);
43  ExponentialFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle,
44  double start, double end, bool expGrowth = false);
45  ExponentialFit(ApplicationWindow *parent, Table *t, const QString& xCol, const QString& yCol, int startRow = 1, int endRow = -1, bool expGrowth = false);
46 
47  double eval(double *par, double x){return par[0]*exp(-x/par[1]) + par[2];};
49 
50  private:
51  void init();
52  void customizeFitResults();
53  void calculateFitCurveData(double *X, double *Y);
54 
56 };
57 
58 class TwoExpFit : public Fit
59 {
60  Q_OBJECT
61 
62  public:
63  TwoExpFit(ApplicationWindow *parent, QwtPlotCurve *c);
64  TwoExpFit(ApplicationWindow *parent, QwtPlotCurve *c, double start, double end);
65  TwoExpFit(ApplicationWindow *parent, Graph *g);
66  TwoExpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
67  TwoExpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
68  TwoExpFit(ApplicationWindow *parent, Table *t, const QString& xCol, const QString& yCol, int startRow = 1, int endRow = -1);
69 
70  double eval(double *par, double x){return par[0]*exp(-x/par[1]) + par[2]*exp(-x/par[3]) + par[4];};
71 
72  private:
73  void init();
74  void calculateFitCurveData(double *X, double *Y);
75 };
76 
77 class ThreeExpFit : public Fit
78 {
79  Q_OBJECT
80 
81  public:
82  ThreeExpFit(ApplicationWindow *parent, QwtPlotCurve *c);
83  ThreeExpFit(ApplicationWindow *parent, QwtPlotCurve *c, double start, double end);
84  ThreeExpFit(ApplicationWindow *parent, Graph *g);
85  ThreeExpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
86  ThreeExpFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
87  ThreeExpFit(ApplicationWindow *parent, Table *t, const QString& xCol, const QString& yCol, int startRow = 1, int endRow = -1);
88 
89  double eval(double *par, double x){return par[0]*exp(-x/par[1]) + par[2]*exp(-x/par[3]) + par[4]*exp(-x/par[5]) + par[6];};
90 
91  private:
92  void init();
93  void calculateFitCurveData(double *X, double *Y);
94 };
95 #endif