Transcript gnuplot

gnuplot 2
3次元処理工学
データファイルのプロット
まずデータファイルの在るディレクトリに移動
gnuplot> cd '………'
gnuplot> plot 'test.txt'
gnuplot> plot 'test.txt' using 1:3
gnuplot> plot 'test.txt' with lines
gnuplot> plot 'test.txt' with points
gnuplot> plot 'test.txt' with linespoints
with points  w p
と省略できる
with lines  w p
with linespoints  w lp
データファイルの書式(1)
# yの値だけ
2.2
2.0
1.9
1.5
1.3
# で始まる行はコメント
(無視される)
一行に一つだけ数値がある場合、
その数値が y の値とみなされ、
x の値は 0, 1, 2, … が用いられる。
gnuplot> plot 'test.txt' w lp
データファイルの書式(2)
# x,
0.0
0.5
0.8
1.5
1.9
y
2.2
2.0
1.9
1.5
1.3
一行に2つの数値がある場合、
1列目を x、2列目を y に用いる。
gnuplot> plot 'test.txt' w lp
データファイルの書式(3)
# x,
0.0
0.5
0.8
1.5
1.9
y1,
2.2
2.0
1.9
1.5
1.3
y2
0.4
0.8
1.0
1.2
1.8
using 1:2
1列目を x、2列目を y に用いる
gnuplot> plot 'test.txt' using 1:2 w lp,
'test.txt' using 1:3 w lp
fitting
データに式をあてはめるのに fit コマンドが使える。
たとえば、y = ax + b という直線で fit するなら
gnuplot> f(x) = a*x + b
gnuplot> fit f(x) 'test.txt' via a,b
(結果が画面に出力される)
gnuplot> plot f(x), 'test.txt'
常に fit が成功するとは限らない。
収束しない場合、パラメタ a, b などの初期値を与
えるとうまくいくこともある。
fitting (例)
damp.txt にあるデータを
t / 
f (t )  ae
sin(t )
という関数で fit してみよ。
gnuplot> set dummy t
とすると、2次元プロットの横軸を t にできる。
動的粘弾性測定
 (t )   0 cost
 (t )   0 cost   
動的粘弾性測定(2)
 (t )   0 cost
 (t )   0 cost   
  0 cos cost   0 sin  sin t
  0 G() cost  G() sin t 
0
G()  cos
0
0
G()  sin 
0
動的粘弾性測定(3)
 (t)   0 cost  Re (t)
 (t)   0e
it


 (t)   0 cost     Re (t)

 (t )   0e
i (t  )

  0 i  it
  e   0e
 0 

 (t )  G () (t )



 0 i
G ()  e  G()  iG()
0


動的粘弾性測定(4)
 (t)  ReG () (t)   0 ReG () exp(it)
*

*
  0 ReG()  iG()cost  i sin t 
  0 G() cost  G() sin t 
演習
stress.txt を (t) の測定データ( t の単
位は秒、 の単位は Pa )とみなし、
 (t )   0 cost   
で fit し、 0 ,  を求める。
これから、この周波数での
貯蔵弾性率G'() 、損失弾性率G"()
を求めよ。ひずみ振幅は  0  0.1 とせよ。
パラメータプロット
gnuplot> set parametric
gnuplot> set parametric
gnuplot> plot cos(t), sin(3*t)
gnuplot> splot sin(v)*(3+cos(u)),
cos(v)*(3+cos(u)),sin(u)