亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bell_curves.java

?? java的小波分析程序
?? JAVA
字號:

package wavelet_util;

import java.io.*;
import sort.qsort;

/**
<p>
class bell_curves
</p>
<p>
  Plot the Haar coefficients as a histogram, in Gnuplot format.  In
  another file generate a normal curve with the mean and standard
  deviation of the histogram.  Using two files allows the histogram
  and the normal curve to be plotted together using gnu plot, where
  the histogram and normal curve will be different colored lines.
  If the spectrum as 256 coefficient points, the files generated
  would be <tt>coef256</tt> and <tt>normal256</tt> for the coefficient
  histogram and the normal curve.  To plot these using gnuplot the
  following command would be used:
</p>
<pre>
   plot 'coef256' with boxes, 'normal256' with lines
</pre>
<p>
  This will result in a gnuplot graph where the histogram is one
  color and the normal curve is another.
</p>
<p>
  A normal curve is a probability distribution, where the values
  are plotted on the x-axis and the probability of that value
  occuring is plotted on the y-axis.  To plot the coefficient 
  histogram in the same terms, the percentage of the total points
  is represented for each histogram bin.  This is the same as the
  integral of the normal curve in the histogram range, if the 
  coefficient histogram fell in a perfect normal distribution.
  For example;
</p>

<p>
<img src="http://www.bearcave.com/misl/misl_tech/wavelets/close_images/coef256.jpg" border=0 align=center>
</p>

 */
public class bell_curves extends plot {

  String class_name() { return "bell_curves"; }

  /**
    A histogram "bin"
   */
  private class bin {
     public bin() {};        // suppress default initialization
     public double start;    // start of the bin
     public double percent;  // percentage of the total points in bin
  }

  /**
   Encapsulate the low and high values of a number range
   */
  private class low_high {
     public low_high() {}
     public low_high( double l, double h )
     {
       low = l;
       high = h;
     }
     public double low;
     public double high;
  }

   /**
      Bell curve info: mean, sigma (the standard deviation)
      
    */
   private class bell_info {
     public bell_info() {}
     public bell_info(double m, double s)
     {
       mean = m;
       sigma = s;
     }
     public double mean;
     public double sigma;
   } // bell_info


  /**
   <p>
   Calculate the mean and standard deviation.
   </p>
   <p>
   The stddev function is passed an array of numbers.
   It returns the mean, standard deviation in the
   bell_info object.
   </p>
   */
  public bell_info stddev( double v[] )
  {
    bell_info stats = null;
    if (v != null && v.length > 0) {
      int N = v.length;
    
      // calculate the mean (a.k.a average)
      double sum = 0.0;
      for (int i = 0; i < N; i++) {
	sum = sum + v[i];
      }
      double mean = sum / (double)N;

      // calculate the standard deviation sum
      double stdDevSum = 0;
      double x;
      for (int i = 0; i < N; i++) {
	x = v[i] - mean;
	stdDevSum = stdDevSum + (x * x);
      }
      double sigmaSquared = stdDevSum / (N-1);
      double sigma = Math.sqrt( sigmaSquared );

      stats = new bell_info(mean, sigma);
    }
    return stats;
  } // stddev


  /**
    <p>
    normal_interval
    </p>

    <p>
    Numerically integreate the normal curve with mean
    <i>info.mean</i> and standard deviation <i>info.sigma</i>
    over the range <i>low</i> to <i>high</i>.
    </P>

    <p>
    There normal curve equation that is integrated is:
     </p>
     <pre>
       f(y) = (1/(s * sqrt(2 * pi)) e<sup>-(1/(2 * s<sup>2</sup>)(y-u)<sup>2</sup></sup>
     </pre>

     <p>
     Where <i>u</i> is the mean and <i>s</i> is the standard deviation.
     </p>

     <p>
     The area under the section of this curve from <i>low</i> to
     <i>high</i> is returned as the function result.
     </p>

     <p>
     The normal curve equation results in a curve expressed as
     a probability distribution, where probabilities are expressed
     as values greater than zero and less than one.  The total area
     under a normal curve is one.
     </p>

     <p>
     The integral is calculated in a dumb fashion (e.g., we're not
     using anything fancy like simpson's rule).  The area in
     the interval <b>x</b><sub>i</sub> to <b>x</b><sub>i+1</sub>
     is 
     </P>

     <pre>
     area = (<b>x</b><sub>i+1</sub> - <b>x</b><sub>i</sub>) * g(<b>x</b><sub>i</sub>)
     </pre>

     <p>
     Where the function g(<b>x</b><sub>i</sub>) is the point on the
     normal curve probability distribution at <b>x</b><sub>i</sub>.
     </p>

     @param info       This object encapsulates the mean and standard deviation
     @param low        Start of the integral
     @param high       End of the integral
     @param num_points Number of points to calculate (should be even)

   */
  private double normal_interval(bell_info info,
				 double low, 
				 double high, 
				 int num_points )
  {
    double integral = 0;

    if (info != null) {
      double s = info.sigma;
      // calculate 1/(s * sqrt(2 * pi)), where <i>s</i> is the stddev
      double sigmaSqrt = 1.0 / (s * (Math.sqrt(2 * Math.PI)));
      double oneOverTwoSigmaSqrd = 1.0 / (2 * s * s);

      double range = high - low;
      double step = range / num_points;
      double x = low;
      double f_of_x;
      double area;
      double t;
      for (int i = 0; i < num_points-1; i++) {
	t = x - info.mean;
	f_of_x = sigmaSqrt * Math.exp( -(oneOverTwoSigmaSqrd * t * t) );
	area = step * f_of_x; // area of one rectangle in the interval
	integral = integral + area;  // sum of the rectangles
	x = x + step;
      } // for
    }

    return integral;
  } // normal_interval



  /**

   <p>
   Output a gnuplot formatted histogram of the area under a normal
   curve through the range <i>m.low</i> to <i>m.high</i> based on the
   mean and standard deviation of the values in the array <i>v</i>.
   The number of bins used in the histogram is <i>num_bins</i>
   </p>

   @param prStr     PrintWriter object for output file
   @param num_bins  Number of histogram bins
   @param m         An object encapsulating the high and low values of v
   @param v         An array of doubles from which the mean and standard deviation is calculated.

   */
  private void normal_curve(PrintWriter prStr,
			    int num_bins,
			    low_high m,
			    double v[] )
  {
    // calculate the mean and standard deviation
    bell_info info = stddev( v );

    int N = v.length;
    int points_per_bin = N/num_bins;
    
    double range = m.high - m.low;
    double step = range / (double)num_bins;
    double start = m.low;
    double end = start + step;
    double area;
    double total_area = 0;

    prStr.println("#");
    prStr.println("# histogram of normal curve");
    prStr.println("# mean = " + info.mean + ", std. dev. = " + info.sigma );
    prStr.println("#");

    for (int i = 0; i < num_bins; i++) {
      area = normal_interval( info, start, end, points_per_bin );
      total_area = total_area + area;
      prStr.println(" " + start + "  " + area );
      start = end;
      end = start + step;
    } // for

    prStr.println("#");
    prStr.println("# Total area under curve = " + total_area );
    prStr.println("#");

  } // normal_curve



  /**
    <p>
    Write out a histogram for the Haar coefficient frequency
    spectrum in gnuplot format.
    </p>

    @param prStr     PrintWriter object for output file
    @param num_bins  Number of histogram bins 
    @param m         An object encapsulating the high and low values from v
    @param v         The array of doubles to histogram
   */
  private void histogram_coef(PrintWriter prStr, 
			      int num_bins, 
			      low_high m,
			      double v[] )
  {
    if (prStr != null && v != null) {
      prStr.println("#");
      prStr.println("# Histogram of Haar coefficients");
      prStr.println("#");
      int len = v.length;
      double range = m.high - m.low;
      double step = range / (double)num_bins;
      double start = m.low;
      double end = start + step;
      int count = 0;
      int i = 0;
      double area = 0;
      
      while (i < len && end <= m.high ) {
	if (v[i] >= start && v[i] < end) {
	  count++;
	  i++;
	}
	else {
	  double percent = (double)count / (double)len;
	  area = area + percent;
	  prStr.println(" " + start + "  " + percent );
	  start = end;
	  end = end + step;
	  count = 0;
	}
      } // for
      prStr.println("#");
      prStr.println("# Total area under curve = " + area );
      prStr.println("#");
    }
  } // histogram_coef


  /**
   <p>
   plot_freq
   </p>

   <p>
   Generate histograms for a set of coefficients
   (passed in the argument <i>v</i>).  Generate
   a seperate histogram for a normal curve.  Both
   histograms have the same number of bins and the
   same scale.
   </p>

   <p>
   The histograms are written to separate files in gnuplot
   format.  Different files are needed (as far as I can tell)
   to allow different colored lines for the coefficient histogram
   and the normal plot.  The file name reflects the number of
   points in the coefficient spectrum.
   </p>

   */
  private void plot_freq( double v[] ) 
     throws IOException
  {
    if (v != null) {
      String file_name = "coef" + v.length;
      PrintWriter prStr = OpenFile( file_name );
      if (prStr != null) {
	final int num_bins = 32;
	qsort.sort( v );
	low_high m = new low_high(v[0], v[v.length-1]);
	histogram_coef( prStr, num_bins, m, v );
	prStr.close();

	file_name = "normal" + v.length;
	prStr = OpenFile( file_name );
	if (prStr != null) {
	  normal_curve( prStr, num_bins, m, v );
	  prStr.close();
	}
	else {
	  IOException ioerr = new IOException();
	  throw ioerr;
	}
      }
      else {
	IOException ioerr = new IOException();
	throw ioerr;
      }
    }
  }  // plot_freq


  /**
   <p>
   This function is passed an ordered set of Haar wavelet
   coefficients.  For each frequency of coefficients
   a graph will be generated, in gnuplot format, that
   plots the ordered Haar coefficients as a histogram.  A
   gaussian (normal) curve with the same mean and standard
   deviation will also be plotted for comparision.
   </p>
   <p>
   The histogram for the coefficients is generated by counting the
   number of coefficients that fall within a particular bin range and
   then dividing by the total number of coefficients.  This results in
   a histogram where all bins add up to one (or to put it another way,
   a curve whose area is one).
   </p>
   <p>
   The standard formula for a normal curve results in a curve showing
   the probability profile.  To convert this curve to the same
   scale as the coefficient histogram, the area under the curve is
   integrated over the range of each bin (corresponding to the 
   coefficient histogram bins).  The area under the normal curve
   is one, resulting in the same scale.
   </p>
   <p>
   The size of the coefficient array must be a power of two.  When the
   Haar coefficients are ordered (see inplace_haar) the coefficient
   frequencies are the component powers of two.  For example, if the
   array length is 512, there will be 256 coefficients from the highest
   frequence from index 256 to 511.  The next frequency set will
   be 128 in length, from 128 to 255, the next will be 64 in length
   from 64 to 127, etc...
   </p>

   <p>
   As the number of coefficients decreases, the histograms become
   less meaningful.  This function only graphs the coefficient
   spectrum down to 64 coefficients.
   </p>

   */
  public void plot_curves( double coef[] )
  {
    if (coef != null) {
      final int min_coef = 64;
      int len = coef.length;
      int end = len;
      int start = len >> 1;
      while (start >= min_coef) {
	double v[] = new double[ start ];
	int ix = 0;
	for (int i = start; i < end; i++) {
	  v[ix] = coef[i];
	  ix++;
	}
	try {
	  plot_freq( v );
	}
	catch (Exception e) {
	  break; // exit the while loop
	}
	end = start;
	start = end >> 1;
      } // for
    }
  } // plot_curves

} // curve_plot

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
337p粉嫩大胆噜噜噜噜噜91av| 久久久亚洲国产美女国产盗摄 | 五月开心婷婷久久| 国产91富婆露脸刺激对白| 欧美xxxx在线观看| 久久99国产精品久久99| 欧美大片在线观看一区二区| 成人免费毛片嘿嘿连载视频| 日韩av成人高清| 日韩精品中文字幕一区二区三区 | 国产成都精品91一区二区三| 日韩中文字幕一区二区三区| 国产精品第一页第二页第三页| www.日韩精品| 一区二区三区四区国产精品| 欧美亚洲国产bt| 日韩二区在线观看| 亚洲在线中文字幕| 日韩欧美区一区二| 欧美在线不卡一区| 秋霞午夜av一区二区三区| 亚洲久草在线视频| 国产精品天天看| 在线日韩一区二区| 免费久久精品视频| 亚洲成人中文在线| 日韩女优毛片在线| 成人午夜电影网站| 精东粉嫩av免费一区二区三区| 亚洲午夜精品在线| 亚洲综合久久久久| 欧美精品一区视频| 日韩无一区二区| 欧美一区二区三区啪啪| 欧美日韩午夜精品| 国产精品一区二区无线| 理论片日本一区| 美国三级日本三级久久99| 国产欧美日本一区视频| 26uuu亚洲| 久久精品亚洲精品国产欧美kt∨ | 在线观看www91| 在线视频一区二区三| 极品美女销魂一区二区三区| 美女尤物国产一区| 免费观看在线综合| 青青草97国产精品免费观看| 中文字幕制服丝袜一区二区三区 | 欧美人妇做爰xxxⅹ性高电影| 精品一区二区三区香蕉蜜桃 | 中文字幕亚洲成人| 3751色影院一区二区三区| 3d成人动漫网站| 91美女片黄在线| 色悠久久久久综合欧美99| 黄色小说综合网站| 国产精品白丝jk黑袜喷水| 国产精品一区免费在线观看| 国产ts人妖一区二区| 日韩av网站在线观看| 亚洲激情图片qvod| 午夜影院久久久| 麻豆精品蜜桃视频网站| 亚洲va国产va欧美va观看| 日本成人在线不卡视频| 精品无人码麻豆乱码1区2区| 粉嫩蜜臀av国产精品网站| 久久99深爱久久99精品| 亚洲国产精品久久不卡毛片| 日本三级亚洲精品| 国产在线播放一区| 94-欧美-setu| 4438亚洲最大| 国产精品美女一区二区在线观看| 亚洲欧美日韩久久| 青草av.久久免费一区| 国产精品1区2区3区在线观看| 美女久久久精品| 日韩不卡在线观看日韩不卡视频| 一区二区三区成人在线视频| 亚洲国产精品精华液2区45| 亚洲精品在线观看视频| 欧美一级日韩免费不卡| 日本一区二区不卡视频| 亚洲成人黄色小说| 午夜精品视频一区| 国产精品亚洲一区二区三区在线 | 亚洲亚洲精品在线观看| 亚洲人成电影网站色mp4| 日本一区二区三级电影在线观看| 一区二区三区高清在线| 一区av在线播放| 久久99久久99| 在线欧美一区二区| 在线观看不卡视频| 欧美日韩亚洲高清一区二区| 国产视频一区不卡| 国产精品国产三级国产aⅴ原创| 亚洲www啪成人一区二区麻豆| 亚洲一区在线观看免费| 亚洲一区二区av在线| 亚洲小说欧美激情另类| 成人午夜私人影院| 337p亚洲精品色噜噜| 亚洲精品欧美在线| 亚洲国产精品久久人人爱蜜臀| 国产91丝袜在线播放0| 3d成人h动漫网站入口| 亚洲最大色网站| 国产91对白在线观看九色| 欧美一级黄色片| 精品久久久久久久久久久久久久久 | 色噜噜狠狠色综合中国| 国产三级精品在线| 欧美aaaaa成人免费观看视频| 久久国产精品色婷婷| 欧美日韩在线三级| 又紧又大又爽精品一区二区| 成人三级伦理片| 欧美在线不卡视频| 日韩精品一区二| 日本亚洲一区二区| 欧美亚洲综合久久| 日韩精品一区二区三区老鸭窝| 日韩制服丝袜先锋影音| 欧美在线一二三四区| 亚洲色图都市小说| 免费成人深夜小野草| 91精品在线免费观看| 日韩在线a电影| 欧美精选一区二区| 香蕉久久一区二区不卡无毒影院 | 成人性色生活片免费看爆迷你毛片| 日韩欧美区一区二| 亚洲人妖av一区二区| 成人在线视频首页| 欧美日韩国产综合草草| 久久免费美女视频| 国产专区综合网| 欧美性高清videossexo| 精品国产乱码久久久久久1区2区| 蜜桃视频在线一区| 91麻豆国产精品久久| 久久品道一品道久久精品| 国产九色sp调教91| 国产女主播在线一区二区| 国产91精品精华液一区二区三区 | 青青草国产精品亚洲专区无| 日韩欧美国产wwwww| 亚洲精品视频免费观看| 国产一区二区毛片| 欧美国产一区视频在线观看| 波多野结衣精品在线| 亚洲免费在线播放| 欧美色图第一页| 亚洲视频精选在线| 国内精品伊人久久久久av影院| 2021国产精品久久精品| youjizz国产精品| 亚洲一区在线免费观看| 日韩区在线观看| 一区二区国产视频| 欧美猛男男办公室激情| 久久精品国产亚洲高清剧情介绍 | 久久久久久久久99精品| 日韩专区一卡二卡| 久久久一区二区三区捆绑**| 日韩国产欧美视频| 久久伊人中文字幕| 色婷婷综合激情| 免费在线看成人av| 91精品婷婷国产综合久久| 亚洲综合在线第一页| 91片在线免费观看| 日本成人在线一区| 中文字幕乱码亚洲精品一区| 国产呦精品一区二区三区网站| 91精品国产欧美一区二区| 国产成人精品三级麻豆| 一区二区三区在线观看视频| 日韩精品一区二区三区在线播放| 日精品一区二区三区| 欧美国产精品一区二区| 欧美色图在线观看| 国产成人自拍在线| 国产欧美日韩精品在线| 国产高清视频一区| 婷婷夜色潮精品综合在线| 欧美丝袜丝交足nylons| 亚洲一区二区三区四区在线| 精品成人一区二区| 在线观看日韩毛片| 国产成人av电影| 国产精品免费视频观看| 日韩一区二区三区四区 | 亚洲精品在线免费播放| 国产麻豆精品视频| 国产精品美女久久久久久久久 | 亚洲激情图片qvod| 久久久亚洲午夜电影|