Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Problems plotting 3D surface and using manipulate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122146] Re: Problems plotting 3D surface and using manipulate
  • From: Heike Gramberg <heike.gramberg at gmail.com>
  • Date: Sun, 16 Oct 2011 07:08:03 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110151003.GAA03167@smc.vnet.net>

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 *)

Manipulate[
 Module[{interp, x, y},
  interp = Interpolation[{{##}, functionName[##, a, b, c]} & @@@
     ptlist];
  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}]


Heike

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