Package com.nr.model

Examples of com.nr.model.Fitmed


    for (i=0;i<N;i++) {
      x[i]=10.0*myran.doub();
      y[i]=sqrt(2.0)+pi*x[i];
    }

    Fitmed fit1 = new Fitmed(x,y);   // Perfect fit, no noise

//    System.out.printf(fit1.a << " %f\n", fit1.b << " %f\n", fit1.abdev);

    sbeps=1.e-12;
    localflag = abs(fit1.a-sqrt(2.0)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitmed: Fitted constant term a has incorrect value");
     
    }

    localflag = abs(fit1.b-pi) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitmed: Fitted slope b has incorrect value");
     
    }

    localflag = fit1.abdev > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitmed: abdev not zero for perfect linear data");
     
    }

    // Test 2
    for (j=0;j<M;j++) {
      for (i=0;i<N;i++) {
        x[i]=10.0*i/(N-1);
        yy[i]=sqrt(2.0)+pi*x[i]+0.1*j/M*(i%2-0.5);
      // All points have same absolute deviation of 0.05
      }

      Fitmed fit2=new Fitmed(x,yy);

//      System.out.printf(endl;
//      System.out.printf(fit2.a << " %f\n", fit2.b << " %f\n", fit2.abdev);
//      System.out.printf(sqrt(2.0)-0.5*0.1*j/M << " %f\n", pi+0.1*j/M/x[N-1] << " %f\n", 0.5*0.1*j/M);

 
View Full Code Here

TOP

Related Classes of com.nr.model.Fitmed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.