Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
What does your "approximate solution" look like? – J. M. 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

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)

enter image description here

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]

enter image description here

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}]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.