MathGroup Archive 2011

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

Search the Archive

Re: Problems plotting 3D surface and using manipulate

To get something that is reasonably responsive you could do something like

functionName[x_, y_, a_?NumericQ, b_, c_] := Sin[a x/4] + Cos[b y/4]*c

ptlist = Tuples[{Range[10, 40], Range[10, 90]}];
(* ptlist is the list of (x,y)-pairs *)

 Module[{interp, x, y},
  interp = Interpolation[{{##}, functionName[##, a, b, c]} & @@@
  Plot3D[interp[x, y], ##, ColorFunction -> "Rainbow",
     PlotRange -> {-2, 2}, PlotPoints -> 20] & @@
   Join[{{x}, {y}}, interp[[1]], 2]], {{a, 0.4}, 0, 1}, {{b, 0.4}, 0,
  1}, {{c, 0.4}, 0, 1}]


On 15 Oct 2011, at 12:03, Adam McGee wrote:

> Good afternoon,
> I could really do with some help with this.
> I have an array containing a series of x, y pairs, and I have a 
formula which takes these x, y pairs as inputs along with three other 
variables a, b, & c to calculate the z value.
> What I need to be able to do is calculate the corresponding z value 
for each x, y pair, then create a surface through these x, y, z points. 
I want to be able to use Manipulate with three slider bars to update the 
values of a, b, and c which in turn update the z calculation and update 
the plot.
> The stage I am currently at is as follows:
> Manipulate [ ListPoint3d [ Table [ functionName [x, y, a, b, c], {x, 
10, 40}, {y, 10, 90} ], ColorFunction -> "Rainbow" ], {a, 0, 1}, {b, 0, 
1}, {c, 0, 1} ]
> With the above example I am not using the correct input matrix 
containing x & y just to try and get it working, but the slider bars are 
unresponsive and it also doesn't look like the values are being 
calculated correctly either.
> Any feedback/advice would be greatly appreciated,
> Many thanks

  • Prev by Date: Puzzling behaviour of ListContoutPlot3D
  • Next by Date: Re: Constructing a huge graph
  • Previous by thread: Problems plotting 3D surface and using manipulate
  • Next by thread: Re: Export