stattest.java

来自「java的小波分析程序」· Java 代码 · 共 63 行

JAVA
63
字号


import dataInput.*;
import wavelets.*;
import wavelet_util.binary;
import experimental.*;

/**
  Test the experimental code to generate a normal curve
  with the mean and standard deviation derived from
  a coefficient spectrum (in this case the highest
  frequency spectrum).

 */
class statTest {

  public static void print_curve( statistics.bell_info info,
				  statistics.point curve[] )
  {
    System.out.println("#");
    System.out.println("# mean = " + info.mean );
    System.out.println("# stddev = " + info.sigma );
    System.out.println("#");
    for (int i = 0; i < curve.length; i++) {
      System.out.println( curve[i].x + "  " + curve[i].y );
    }
    System.out.println();
  }


  public static void main( String[] args )
  {
    tsRead ts = new tsRead("amat_close");
    int len = ts.getSize();
    if (len > 0) {
      len = binary.nearestPower2(len);
      ts.setSize( len );
      double vals[] = ts.getArray();

      wavelets.inplace_haar haar = new inplace_haar();
      haar.wavelet_calc( vals );
      haar.order();
      int end = vals.length;
      int start = end >> 1;
      double coef[] = new double[ start ];
      int ix = 0;
      for (int i = start; i < end; i++) {
	coef[ix] = vals[i];
	ix++;
      }

      statistics.bell_info info = statistics.stddev( coef );
      if (info != null) {
	statistics.point curve[] = statistics.normal_curve(info, start);
	// print_curve( info, curve );
	statistics stat = new statistics();
        stat.integrate_curve( curve );
      }
    } 
  } // main

} // statTest

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?