12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

60 chapter 3gnuplot> set output "plt.ps"Send figure to filegnuplot> replotPlot again so file is sentgnuplot> quitOr get out of gnu window% lp plt.ps Unix print command3.4.3 Gnuplot Surface (3-D) PlotsA 2-D plot is fine for visualizing the potential field V (r)=1/r surrounding a singlecharge. However, when the same potential is expressed as a function of Cartesiancoordinates, V (x, y)=1/ √ x 2 + y 2 , we need a 3-D visualization. We get that bycreating a world in which the z dimension (mountain height) is the value of thepotential and x and y lie on a flat plane below the mountain. Because the surfacewe are creating is a 3-D object, it is not possible to draw it on a flat screen, andso different techniques are used to give the impression of three dimensions to ourbrains. We do that by rotating the object, shading it, employing parallax, and othertricks.The surface (3-D) plot command is splot, and it is used in the same manner asplot—with the obvious extension to (x, y, z). A surface (Figure 3.8) is specified byplacing the z(x, y) values in a matrix but without ever giving the x and y valuesexplicitly. The x values are the row numbers in the matrix and the y values are thecolumn values (Figure 3.8). This means that only the z values are read in and thatthey are read in row by row, with different rows separated by blank lines:row 1 (blank line) row 2 (blank line) row 3 . . . row N.Here each row is input as a column of numbers, with just one number per line. Forexample, 13 columns each with 25 z values would be input as a sequence of 25 dataelements, followed by a blank line, and then another sequence followed by a blankline, and so on:✞☎✝0.00.6950843693971481.3553052083635031.9461146066793003...−1.0605832625347442−0.380140746321537[blank line ]0.00.64038687572353011.2556172093991282...2.30599770702864732.685151549102467[blank line ]2.9987593603912095...Although there are no explicit x and y values given, Gnuplot plots the data withthe x and y assumed to be the row and column numbers.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 60

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!