MathGroup Archive 2006

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

Search the Archive

Re: General--IF condition in Plot3D


madhukarrapaka at yahoo.com wrote:
> How to use a IF condition in Plot3D??
> 
> For example:
> I have "I" values caluclated by I=P/2*Pi*r*L .; where P=10.3,L=0.45,r=dist. 
> So if i want to plot "I" when "r<x", how to do it??
> (Here i am giving my procedure thru which i am getting a Plot with some warning)
> r[x_,y_]:=Sqrt[x^2+y^2];
> I[x_,y_]:=P/2*Pi*r[x_,y_]*L
> Plot3D[If[r[x,y]<=0.082,I[x,y]],{x,-0.082,0.082},{y,-0.082,0.082}]
 > [...]
> Is there anything wrong in the syntax or range specification.

The following works:

r[x_, y_] := Sqrt[x^2 + y^2];
i[x_, y_] := (P/2)*Pi*r[x, y]*L
Plot3D[Boole[r[x, y] <= 0.082]*i[x, y] /.
  {P -> 10.3, L -> 0.45}, {x, -0.082, 0.082},
  {y, -0.082, 0.082}];

HTH,
Jean-Marc


  • Prev by Date: Re: Matrix Multiplication (with a twist)
  • Next by Date: Re: Why polynomial Can't output as single Number?
  • Previous by thread: General--IF condition in Plot3D
  • Next by thread: Graphics--If condition in Plot3D?????????