Re: Extremely simple problem, and NO success!
- To: mathgroup at smc.vnet.net
- Subject: [mg2674] Re: Extremely simple problem, and NO success!
- From: wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner)
- Date: Mon, 4 Dec 1995 01:41:43 -0500
- Organization: University of Colorado, Boulder
In article <49rknk$k50 at dragonfly.wri.com>,
Roland Larsson <LARSSON at brivs2.bartol.udel.edu> wrote:
>Please, anybody out there, help me. I just started to have a look at
>Mathematica, and it is driving me &%$#@* nuts! What I want to do is
>REALLY simple:
>
>1. Run FORTRAN code, write some data (x,y and z) to a file. Three columns.
>
>2. Start Mathematica, read my data file from 1.
>
>3. Make a 3D plot, using the x, y and z values from my data file.
>
>Simple? That's what I thought, but after 5 hours of trial-and-error, and
Well, I can't help you with #1, but I assume you got past that part. :-)
For #2, you should be able to read the data using
ReadList[{Number, Number, Number}].
For #3, that depends on whether you're trying to produce a point
(scatter) plot or a surface plot. For a scatter plot, load the
standard package "Graphics`Grahphics3D`" and use the function
ScatterPlot3D.
Surface plots of data are harder, because there are several cases:
1. If your data are on a regularly spaced mesh, used
Partition to group the one-dimensional list of points
into an array, and then use ListPlot3D.
2. If your data are on an irregularly spaced mesh,
use Partition as before and then use ListSurfacePlot3D
(also in the Graphics3D package).
3. If your data are completely irregular, you can either
(a) fit an interpolating function to the data and plot
that using Plot3D, or
(b) use TriangularSurfacePlot (also in a standard
package) on the data to triangulate the data. If you
go this route, you might want to get a MathLink program
written by Tom Wickham-Jones that does the
computationally-intensive triangulation step.
See his book.
There are examples of all of this in a tech support note written by
Robby Villegas that appeared in the Mathematica Journal 4(2):58-61.
Dave Wagner
Principia Consulting
(303) 786-8371
dbwagner at princon.com
http://www.princon.com/princon