# How Can I plot 3D figures using discrete data in one dimension?

I have an approximate solution for the function u[x,t] using the semi-discretization method in time step. For example, I have u[x,ti] for all x and some ti. I want to plot a 3D figure for this function and I don't know how to plot it.

-
What does your "approximate solution" look like? –  Ｊ. Ｍ. Jul 10 '12 at 14:57
Hi Parnia, welcome to Mathematica.SE! Plot3D, ListPlot3D, and DiscretePlot3D come to mind. Did you perhaps try those? –  Sjoerd C. de Vries Jul 10 '12 at 15:33

## 1 Answer

If I understand correctly instead of a function defined analytically:

f[x_, t_] := Sin[x^2 + t^2]


You have a set of curves resulting from a discrete variable, similarly to:

fset[x_] = f[x, #] & /@ (Range[100]/50)


I think the easiest way to plot this is to make 2nd variable discrete too and use ListPlot3D:

ListPlot3D[fset /@ (Range[100]/50),  ColorFunction -> "SouthwestColors", Mesh -> None]


Another way, "preserving" continuous definition of one variable and keeping the other discrete is to use ParametricPlot3D:

ParametricPlot3D[ Evaluate@Transpose[{ConstantArray[x, 100], Range[100]/50,
fset[x]}], {x, 0, 2}, PlotStyle -> Directive[Blue, Opacity[.5]], BoxRatios -> {1, 1, 1/2}]


-