MathGroup Archive 2004

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

Search the Archive

Re: Combining 2D graphs into a 3D graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49788] Re: Combining 2D graphs into a 3D graph
  • From: Daniel Herring <dherring at at.uiuc.dot.edu>
  • Date: Sat, 31 Jul 2004 03:14:08 -0400 (EDT)
  • References: <cddpep$pcp$1@smc.vnet.net> <cdj28e$nd6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> 2. Is there a way for me to fit a surface to the family of curves I
> have?  Being able to stack the curves is good enough, but I guess my
> boss will have this further suggestion.

I spent *way* too much time on this, but it was interesting learning.
Here's an example which may be of some help.

(* Generate some interesting test functions *)
f[1][x_] := Sin[x];
f[2][x_] := Sin[2 x];
f[3][x_] := Cos[x];
f[4][x_] := Cos[x + Pi/3];
f[5][x_] := Cos[x + Pi/2];

(* Specify the problem domain *)
functions = 5;
xmin = -Pi;
xmax = Pi;

(* Sample and interpolate the information *)
data = Table[f[n][x], {n, functions}, {x, xmin, xmax}];
func = ListInterpolation[data, {{1, functions}, {xmin, xmax}}];

(* Make a pretty plot *)
Plot3D[func[n, x], {n, 1, functions}, {x, xmin, xmax},
	AxesLabel -> {"n", "x", "f[x]"},
	Mesh -> False, PlotPoints -> 50];


Hope that helps,
Daniel


  • Prev by Date: Re: 3D graphs with constraints
  • Next by Date: Re: uniquely change curve colors and make them darker
  • Previous by thread: Re: Combining 2D graphs into a 3D graph
  • Next by thread: Mathlink memory hog