SignalProcess.java
01 /*
02  * $Id: SignalProcess.java,v 1.13 2008/03/09 14:46:17 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap20;
08 
09 import java.io.IOException;
10 
11 import org.mklab.nfc.matrix.DoubleMatrix;
12 import org.mklab.tool.graph.gnuplot.Canvas;
13 import org.mklab.tool.graph.gnuplot.Gnuplot;
14 
15 
16 /**
17  @author koga
18  @version $Revision: 1.13 $, 2004/05/07
19  */
20 public class SignalProcess {
21 
22   /**
23    * メインメソッド
24    
25    @param args コマンドライン引数
26    @throws InterruptedException 強制終了された場合
27    @throws IOException gnuplotプロセスを起動できない場合
28    */
29   @SuppressWarnings("nls")
30   public static void main(String[] argsthrows InterruptedException, IOException {
31     DoubleMatrix t = DoubleMatrix.series(010.001);
32     DoubleMatrix y = (t.multiply(* Math.PI * 50)).sinElementWise().add((t.multiply(* Math.PI * 120)).sinElementWise().multiply(2));
33     DoubleMatrix yn = y.add(DoubleMatrix.normalRandom(y));
34     Gnuplot gnuplot = new Gnuplot();
35     Canvas canvas = gnuplot.createCanvas();
36     canvas.plot((DoubleMatrix)t.getSubVector(150)(DoubleMatrix)yn.getSubVector(150)new String[] {"yn"});
37     Thread.sleep(10000);
38     gnuplot.close();
39   }
40 }