File: contours.dem

package info (click to toggle)
gnuplot 4.0.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,396 kB
  • ctags: 6,623
  • sloc: ansic: 63,562; lisp: 5,011; cpp: 970; sh: 900; makefile: 756; objc: 647; asm: 539; csh: 297; awk: 235; pascal: 192; perl: 44
file content (153 lines) | stat: -rw-r--r-- 4,389 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#
# $Id: contours.dem,v 1.9 2003/10/28 05:35:54 sfeam Exp $
#
set samples 20
set isosamples 21
set xlabel "X axis" -5,-2
set ylabel "Y axis" 4,-1
set zlabel "Z axis"
set title "3D gnuplot demo - contour plot"
set contour
splot x*y
pause -1 "Hit return to continue (1)"
set cntrparam levels 20
set title "3D gnuplot demo - contour plot (more contours)"
replot
pause -1 "Hit return to continue (2)"
set cntrparam levels incr -100,10,100
set title "3D gnuplot demo - contour plot (every 10, starting at -100)"
replot
pause -1 "Hit return to continue (3)"
set cntrparam levels disc -75,-50,0
set title "3D gnuplot demo - contour plot (at -75, -50, 0)"
replot
pause -1 "Hit return to continue (4)"
set cntrparam levels auto 10
set title "3D gnuplot demo - contour plot on base grid"
set contour base
splot x**2-y**2
pause -1 "Hit return to continue (5)"
set title "3D gnuplot demo - contour plot on surface"
set contour surface
replot
pause -1 "Hit return to continue (6)"
set title "3D gnuplot demo - contour plot on both"
set contour both
replot
pause -1 "Hit return to continue (7)"
set contour base
set title "3D gnuplot demo - 2 surfaces"
splot x**2*y**3, x**3*y**2
pause -1 "Hit return to continue (8)"
set title "3D gnuplot demo - some more interesting contours"
splot x*y / (x**2 + y**2 + 0.1)
pause -1 "Hit return to continue (9)"
splot [x=-3:3] [y=-3:3] sin(x) * cos(y)
pause -1 "Hit return to continue (10)"
set zrange [-1.0:1.0]
replot
pause -1 "Hit return to continue (11)"
set samples 6
set isosamples 6
set cntrparam levels 5
set title "3D gnuplot demo - low resolution (6x6)"
replot
pause -1 "Hit return to continue (12)"
set cntrparam bspline
set title "3D gnuplot demo - low resolution (6x6) using bspline approx."
replot
pause -1 "Hit return to continue (13)"
set cntrparam order 8
set title "3D gnuplot demo - low resolution (6x6) raise bspline order."
replot
pause -1 "Hit return to continue (14)"
set cntrparam linear
set auto
set title "3D gnuplot demo - low resolution (6x6) using linear contours."
splot x*y
pause -1 "Hit return to continue (15)"
set cntrparam order 4
set cntrparam bspline
set title "3D gnuplot demo - low resolution (6x6) using bspline approx."
replot
pause -1 "Hit return to continue (16)"
set samples 25
set isosamples 26
set title "3D gnuplot demo - contour of Sinc function"
splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
pause -1 "Hit return to continue (17)"
splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)
pause -1 "Hit return to continue (18)"
set cntrparam levels 10
set xrange [0:15]
set yrange [0:15]
set auto
set zrange [-1.0:1.0]
set style data lines
set title "3D gnuplot demo - contour of data grid plotting"
set parametric
splot "glass.dat"
pause -1 "Hit return to continue (19)"
set zrange [-1.2:1.2]
unset parametric
splot "glass.dat" using 1
pause -1 "Hit return to continue (20)"
set view 0,0,1
unset surface
set title "3D gnuplot demo - 2D contour projection of last plot"
replot
pause -1 "Hit return to continue (21)"

#From: shen@athena.cs.uga.edu (Mingzuo Shen)
#Subject: Rosenbrock's function: some answers and thanks
#Date: Wed, 23 Jun 1993 20:50:36 GMT
#
#    Last night I asked for help with a contour plot for the function:
#
#    (1-x)**2 + 100 * (y - x**2)**2
#
#which should have a minimum at (x=1,y=1). This is the 2D case of a more
#general function named after Rosenbrock (the book I am reading does not
#give a reference to any paper/book by this person):
#
#    for even integer n,
#
#    f(x) = \sum_{j=1,3,5,\ldots,n} [(1 - x_j)^2 + 100(x_{j+1} - x_j^2)^2]
#
#where x is a vector (x1, x2, ..., x_n). This function also have a minimum
#at (1,1,...,1), which lies at the base of a "banana-shaped valley".
#Here are the new commands I have tried.
#
set auto
set surface
unset contour
set cntrparam levels 5
set cntrparam linear
set samples 100
set logscale z
set hidden3d
set isosamples 20
set view 70,335,1
set xlabel "x"
set ylabel "y"
set title "Rosenbrock Function"
splot [0.9:1.1] [0.9:1.1] (1-x)**2 + 100*(y - x**2)**2
pause -1 "Hit Return to Continue (22)"

set logscale z
set hidden3d
set isosamples 60
set ticslevel 0.
set view 20,340	#HBB: ,1,2
set xlabel "x"
set ylabel "y"
splot [-1.5:1.5] [-0.5:1.5] (1-x)**2 + 100*(y - x**2)**2
pause -1 "Hit Return to Continue (23)"
set contour
unset surface
replot
pause -1 "Hit Return to Continue (24)"
#
# Clean up:
#
reset