NonLinearFit.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NONLINEARFIT_H
00030 #define NONLINEARFIT_H
00031
00032 #include "Fit.h"
00033
00034 using namespace std;
00035
00036 class NonLinearFit : public Fit
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 NonLinearFit(ApplicationWindow *parent, Graph *g);
00042 NonLinearFit(ApplicationWindow *parent, QwtPlotCurve *c);
00043 NonLinearFit(ApplicationWindow *parent, QwtPlotCurve *c, double start, double end);
00044 NonLinearFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle);
00045 NonLinearFit(ApplicationWindow *parent, Graph *g, const QString& curveTitle, double start, double end);
00046 NonLinearFit(ApplicationWindow *parent, Table *t, const QString& xCol, const QString& yCol, int startRow = 1, int endRow = -1);
00047
00048 double eval(double *par, double x);
00049
00050 virtual bool setParametersList(const QStringList& lst);
00051 virtual bool setFormula(const QString& s, bool = true);
00052
00053 QMap<QString, double> constants(){return d_constants;};
00054 void setConstant(const QString& parName, double val);
00055 void removeConstant(const QString& parName){d_constants.remove(parName);};
00056 void removeConstants(){d_constants.clear();};
00057 int constantsCount(){return d_constants.size();};
00058 QList<QString> constantsList(){return d_constants.keys();};
00059 double constValue(const QString& name){return d_constants.value(name);};
00060
00061 virtual QString legendInfo();
00062 static QStringList guessParameters(const QString& s, bool *error = 0, string *errMsg = 0);
00063
00064 protected:
00065 QString logFitInfo(int iterations, int status);
00066 FunctionCurve* insertFitFunctionCurve(const QString& name, int penWidth = 1, bool updateData = true);
00067
00068 private:
00069 void calculateFitCurveData(double *X, double *Y);
00070 void init();
00071 virtual void removeDataSingularities();
00072 void removePole(int index);
00073
00074 QMap<QString, double> d_constants;
00075 };
00076 #endif