*exec init * * kumac pour ajustement d'une fonction periodique * uses fperiodique.f and fperfit.f * MC 05/01 * * # of measurements n=25 * # of initial values 0...n nf=1000 * Initialize histograms 1d 100 '' [n] 0. [n] 1d 101 '' [nf] 0. [n]+1 * Initialize vectors si x=array([n],0.#[n]) si y=array([n]) v/cr ini_esti(1) v/cr h([nf]) * calculate points to fit si y=sin(2*pi*x/[n]); put/cont 100 y do i=1,[nf] * determine initial estimation b=[i]*[n]/[nf]; v/in ini_esti(1) [b] * fit, do not store, quiet mode h/fit 100 fperfit.f NQ 1 ini_esti * save result fit_res=ini_esti; v/in h([i]) [fit_res] enddo put/cont 101 h * graphical presentation set stat 10 set xwin 1. set ywin opt grid zone 1 2 title 'Determiner la frequence pour une fonction periodique' max 101 [n];min 101 -[n] h/pl 101 atit 'Estimation initial' 'Resultat du fit' fun/pl fperiodique.f(x) 0. [n]+1 atit 'Frequence' '[v]^2!' *