00001 #include<iostream> 00002 #include<math.h> 00003 #include<stdlib.h> 00004 #include<time.h> 00005 00006 #include "../def.h" 00007 #include "../model.h" 00008 #include "../nr.h" 00009 00010 using namespace std; 00011 00012 void outSimit(GlobExp ex[],Glob *globs,double *t,long n,double **y) 00013 { 00014 long k,l; 00015 long idum=-time(NULL); 00016 long nobs=ex[1].nobs; 00017 ofstream out; 00018 00019 out.open(ex[1].fileName); 00020 00021 if(globs->sig==0) 00022 { 00023 for(k=1;k<=n;k++) 00024 { 00025 out << t[k]; 00026 for(l=1;l<=nobs;l++) 00027 out << " " << y[k][l] << " 1"; 00028 out << endl; 00029 } 00030 00031 } 00032 else 00033 { 00034 double *max=dvector(1,nobs),*min=dvector(1,nobs); 00035 for(l=1;l<=nobs;l++) 00036 { 00037 max[l]=y[1][l]; 00038 min[l]=y[1][l]; 00039 } 00040 for(k=2;k<=n;k++) 00041 { 00042 for(l=1;l<=nobs;l++) 00043 { 00044 if(max[l]<y[k][l]) 00045 max[l]=y[k][l]; 00046 if(min[l]>y[k][l]) 00047 min[l]=y[k][l]; 00048 } 00049 } 00050 for(k=1;k<=n;k++) 00051 { 00052 out << t[k] ; 00053 for(l=1;l<=nobs;l++) 00054 out << " " << y[k][l]+globs->sig*fabs(max[l]-min[l])*gasdev(&idum) << " " << globs->sig*fabs(max[l]-min[l]); 00055 out << endl; 00056 } 00057 } 00058 00059 }