Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
3  
What does your "approximate solution" look like? –  J. M. Jul 10 '12 at 14:57
1  
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
add comment

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)

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
add comment

Your Answer

 
discard

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.