MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Graphics using external data list.

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Graphics using external data list.
  • From: Scott Herod <sherod at picard.colorado.edu>
  • Date: Mon, 14 Sep 92 12:11:30 -0600

I have a simple program which draws space curves using data from
a C based ODE solver.  Since such a program is often asked for I
am mailing this in hopes that people can convert it to their needs.

The code is the following:

(******************************************************************)
(*    Simple drawing routine.  It reads a data file containing a  *)
(*    number denoting the size of the file and then a lenX4       *)
(*    matrix of data in the form                                  *)
(*                 t1  x1  y1  z1                                 *)
(*                 t2  x2  y2  z2                                 *)
(*                 .   .   .   .                                  *)
(*                                                                *)
(*    A plot is then drawn of the curve (x[t],y[t],z[t]).         *)
(*    file is a string containing the name of the data file.      *)
(******************************************************************)

draw[file_] :=
Block[{f,len,wdt},
f=OpenRead[file];
len=Read[f,Number];
(* wdt=Read[f,Number]; *)
wdt = 4;
x=ReadList[f,Table[Number,{wdt}]];
Close[f];
Show[
	Table[
		Graphics3D[ Line[ {x[[y,{1,2,3}]], x[[y+1,{1,2,3}]]} ] ],
		{y,1,len-1}
	], BoxRatios->{1,1,1}
    ]
]




Scott A. Herod
Applied Mathematics
University of Colorado, Boulder
(sherod at newton.colorado.edu)





  • Prev by Date: Re: Integrating Normal Distributions gives the wrong answer
  • Next by Date: questions about tensors,variable transformations
  • Previous by thread: improved version of histogram.m
  • Next by thread: questions about tensors,variable transformations