Doxygen Source Code Documentation
model_gammavar.c File Reference
#include <math.h>#include "NLfit_model.h"Go to the source code of this file.
Functions | |
| void | signal_model (float *gs, int ts_length, float **x_array, float *ts_array) |
| DEFINE_MODEL_PROTOTYPE MODEL_interface * | initialize_model () |
Function Documentation
|
|
Definition at line 45 of file model_gammavar.c. References MODEL_interface::call_func, MODEL_interface::label, MODEL_interface::max_constr, MODEL_interface::min_constr, MODEL_SIGNAL_TYPE, MODEL_interface::model_type, MODEL_interface::params, MODEL_interface::plabel, signal_model(), and XtMalloc.
00046 {
00047 MODEL_interface * mi = NULL;
00048
00049
00050 /*----- allocate memory space for model interface -----*/
00051 mi = (MODEL_interface *) XtMalloc (sizeof(MODEL_interface));
00052
00053
00054 /*----- define interface for the gamma variate model -----*/
00055
00056 /*----- name of this model -----*/
00057 strcpy (mi->label, "GammaVar");
00058
00059 /*----- this is a signal model -----*/
00060 mi->model_type = MODEL_SIGNAL_TYPE;
00061
00062 /*----- number of parameters in the model -----*/
00063 mi->params = 4;
00064
00065 /*----- parameter labels -----*/
00066 strcpy (mi->plabel[0], "t0");
00067 strcpy (mi->plabel[1], "k");
00068 strcpy (mi->plabel[2], "r");
00069 strcpy (mi->plabel[3], "b");
00070
00071 /*----- minimum and maximum parameter constraints -----*/
00072 mi->min_constr[0] = 45.0; mi->max_constr[0] = 75.0;
00073 mi->min_constr[1] = -200.0; mi->max_constr[1] = 200.0;
00074 mi->min_constr[2] = 0.0; mi->max_constr[2] = 1.0;
00075 mi->min_constr[3] = 1.0; mi->max_constr[3] = 100.0;
00076
00077 /*----- function which implements the model -----*/
00078 mi->call_func = &signal_model;
00079
00080
00081 /*----- return pointer to the model interface -----*/
00082 return (mi);
00083 }
|
|
||||||||||||||||||||
|
Definition at line 102 of file model_gammavar.c. Referenced by initialize_model().
00109 {
00110 int it; /* time index */
00111 float t; /* time */
00112 float fval; /* time series value at time t */
00113
00114
00115 for (it = 0; it < ts_length; it++)
00116 {
00117 t = x_array[it][1];
00118 if ((t <= gs[0]) || (gs[3] <= 0.0))
00119 fval = 0.0;
00120 else
00121 fval = gs[1] * exp( log(t-gs[0]) * gs[2] ) * exp(-(t-gs[0])/gs[3]);
00122 ts_array[it] = fval;
00123 }
00124
00125 }
|