01 /*
02 * $Id: MultiPlot2.java,v 1.7 2008/02/02 03:06:29 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap12old;
08
09 import org.mklab.nfc.matrix.DoubleMatrix;
10 import org.mklab.tool.graph.mgplot.Mgplot;
11
12
13 /**
14 * データ数の異なる複数のグラフを描画するサンプルです。
15 * @author koga
16 * @version $Revision: 1.7 $, 2004/05/01
17 */
18 public class MultiPlot2 {
19
20 /**
21 * メインメソッド
22 *
23 * @param args コマンドライン引数
24 * @throws InterruptedException 強制終了された場合
25 */
26 public static void main(String[] args) throws InterruptedException {
27 DoubleMatrix t1 = DoubleMatrix.series(0, 4 * Math.PI, 0.05);
28 DoubleMatrix t2 = DoubleMatrix.series(0, 4 * Math.PI, 1.0);
29 DoubleMatrix s1 = t1.sinElementWise();
30 DoubleMatrix c1 = t1.cosElementWise();
31 DoubleMatrix c2 = t2.cosElementWise();
32 Mgplot.plot(1, t1, s1, new String[] {"sin(t)"}); //$NON-NLS-1$
33 Mgplot.replot(1, t1, c1, new String[] {"cos(t) (fine)"}); //$NON-NLS-1$
34 Mgplot.replot(1, t2, c2, new String[] {"cos(t) (gross)"}); //$NON-NLS-1$
35 Thread.sleep(10000);
36 Mgplot.quit();
37 }
38 }
|