MultiPlot2.java
01 /*
02  * $Id: MultiPlot2.java,v 1.12 2008/02/02 03:06:27 koga Exp $
03  *
04  * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05  *
06  */
07 package matxbook.chap12;
08 
09 import java.io.IOException;
10 
11 import org.mklab.nfc.matrix.DoubleMatrix;
12 import org.mklab.nfc.util.Pause;
13 import org.mklab.tool.graph.gnuplot.Canvas;
14 import org.mklab.tool.graph.gnuplot.Gnuplot;
15 
16 
17 /**
18  @author koga
19  @version $Revision: 1.12 $, 2004/05/01
20  */
21 public class MultiPlot2 {
22 
23   /**
24    * メインメソッド
25    
26    @param args コマンドライン引数
27    @throws InterruptedException 強制終了された場合
28    @throws IOException キーボードから入力できない場合
29    */
30   @SuppressWarnings("nls")
31   public static void main(String[] argsthrows InterruptedException, IOException {
32     DoubleMatrix t1 = DoubleMatrix.series(0* Math.PI, 0.05);
33     DoubleMatrix t2 = DoubleMatrix.series(0* Math.PI, 1.0);
34     DoubleMatrix s1 = t1.sinElementWise();
35     DoubleMatrix c1 = t1.cosElementWise();
36     DoubleMatrix c2 = t2.cosElementWise();
37     Gnuplot gnuplot = new Gnuplot();
38     Canvas canvas = gnuplot.createCanvas();
39     canvas.plot(t1, s1, new String[] {"sin(t)"});
40     canvas.setHolding(true);
41     canvas.plot(t1, c1, new String[] {"cos(t) (fine)"});
42     canvas.plot(t2, c2, new String[] {"cos(t) (gross)"});
43     canvas.setHolding(false);
44     Pause.pause();
45     gnuplot.close();
46   }
47 }