Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5679

Re: Problems plotting 3D surface and using manipulate

From Heike Gramberg <heike.gramberg@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Problems plotting 3D surface and using manipulate
Date 2011-10-16 11:15 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j7eecv$eke$1@smc.vnet.net> (permalink)
References <201110151003.GAA03167@smc.vnet.net>

Show all headers | View raw


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
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Problems plotting 3D surface and using manipulate Heike Gramberg <heike.gramberg@gmail.com> - 2011-10-16 11:15 +0000

csiph-web