Doxygen Source Code Documentation
model_quadratic.c File Reference
#include <math.h>#include "NLfit_model.h"Go to the source code of this file.
| Functions | |
| void | noise_model (float *gn, int ts_length, float **x_array, float *ts_array) | 
| DEFINE_MODEL_PROTOTYPE MODEL_interface * | initialize_model () | 
Function Documentation
| 
 | 
| 
 Definition at line 42 of file model_quadratic.c. References MODEL_interface::call_func, MODEL_interface::label, MODEL_interface::max_constr, MODEL_interface::min_constr, MODEL_NOISE_TYPE, MODEL_interface::model_type, noise_model(), MODEL_interface::params, MODEL_interface::plabel, and XtMalloc. 
 00043 {
00044   MODEL_interface * mi = NULL;
00045 
00046 
00047   /*----- allocate memory space for model interface -----*/
00048   mi = (MODEL_interface *) XtMalloc (sizeof(MODEL_interface));
00049 
00050 
00051   /*----- define quadratic noise model -----*/   
00052 
00053   /*----- name of this model -----*/
00054   strcpy (mi->label, "Quadratic");
00055 
00056   /*----- this is a noise model -----*/
00057   mi->model_type = MODEL_NOISE_TYPE;
00058 
00059   /*----- number of parameters in the model -----*/
00060   mi->params = 3;
00061 
00062   /*----- parameter labels -----*/
00063   strcpy (mi->plabel[0], "constant");
00064   strcpy (mi->plabel[1], "linear");
00065   strcpy (mi->plabel[2], "quadratic");
00066 
00067   /*----- minimum and maximum parameter constraints -----*/
00068   mi->min_constr[0] = -100.0;   mi->max_constr[0] = 100.0;
00069   mi->min_constr[1] =   -1.0;   mi->max_constr[1] =   1.0;
00070   mi->min_constr[2] =   -0.1;   mi->max_constr[2] =   0.1;
00071   
00072   
00073   /*----- function which implements the model -----*/
00074   mi->call_func = noise_model;
00075 
00076 
00077   /*----- return pointer to the model interface -----*/
00078   return (mi);
00079 }
 | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 95 of file model_quadratic.c. Referenced by initialize_model(). 
 00102 {
00103   int it;                           /* time index */     
00104   float t;                          /* time */
00105   float fval;                       /* time series value at time t */  
00106 
00107 
00108   for (it = 0;  it < ts_length;  it++)
00109     {
00110       t = x_array[it][1];
00111       fval = gn[0] + gn[1]*t + gn[2]*t*t;
00112       ts_array[it] = fval;
00113     }
00114   
00115 }
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  