881 re(3):球面上の関数の等高線、色調表示 |
等高線は、例えば x,y,c (c=その関数値) に対する等高線データを
set table を使って吐き出させておいて、それを using 1:2:(f($1,$2))
(f(x,y)=表示する曲面を表す式) で表示させる、という手もあります。
前回のサンプルよりも多少等高線らしく見えるサンプルをつけます。
----- test1.awk -----
BEGIN{
for(x=-10;x<=10;x++){
for(y=-10;y<=10;y++)
printf "%f %f %f %f\n",x,y,2*x-3*y,sqrt(x*x+y*y);
print "";
}}
# 3 列目: 表示曲面、4 列目: 関数値
-----
----- test2.gp -----
unset surface
set contour
set cntrparam levels incremental 0,2.5
set term table
set out 'test2.dat'
splot 'test1.dat' using 1:2:4
set out
-----
----- test3.gp -----
f(x,y)=2*x-3*y
set view 27,30
set zrange [-60:60]
set multiplot
set pm3d
unset surface
splot 'test1.dat' using 1:2:3:4
unset pm3d
unset key
set surface
splot 'test2.dat' using 1:2:(f($1,$2)) w l lt 3
unset multiplot
-----
これらを、
awk -f test1.awk > test1.dat
gnuplot test2.gp
gnuplot -persist test3.gp
とすると、表示曲面 2*x-3*y 上で、関数 x*x-y*y の等高線と、その値に
対する色が描かれると思います (うまくいけば)。
gnuplot の demo ファイルをあたると、もっとまともなものが出てくるか
も知れません。
〔ツリー構成〕
【873】 球面上の関数の等高線、色調表示 2005/6/22(水)15:27 たけもと (724) |
┣【875】 re(1):球面上の関数の等高線、色調表示 2005/6/22(水)20:11 竹の (467) |
┣【880】 re(2):球面上の関数の等高線、色調表示 2005/6/24(金)14:54 たけもと (357) |
┣【881】 re(3):球面上の関数の等高線、色調表示 2005/6/24(金)19:58 竹の (1128) |
※ 『クリックポイント』とは一覧上から読み始めた地点を指し、ツリー上の記事を巡回しても、その位置に戻ることができます.