MathGroup Archive 1998

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

Search the Archive

RE: 3-D to 2-D slice revisited


Michael Mihalik wrote:
________________________
I posted a message on here a week or so ago, about taking a slice of a
3-D graph, and then taking only one slice of it and looking at it in
2-D.

<..NDSolve example snipped..>

I want to take the graph generated from the above partial differential
equation and view the y-z slice at x = 1. _________________________

I think this will solve your problem.

In[1]:=
soln=NDSolve[{  D[y[x,t],t]== D[y[x,t],x,x]*0.01-D[y[x,t],t],
y[x,0]==If[x>0,0,1], y[0,t]==1,Derivative[1,0][y][1,t]==0} , y,
{x,0,1}, {t,0,2}];

In[2]:=
Clear[t];
ys[t_]=y[x,t]/.soln/.x->1;

In[3]:=
Plot[ys[t],{t,0,1.1}];

(* Graphics not shown. *)

Note:
When you use 't_' on the left side of '=' any global values for 't' will
get in the way.  So I Clear[t] first.  Actually I think your use of
NDSolve would fail if 't' had a global vale, so the point is probably
mute.  I just like to be careful about using patterns on the left side
of '='.  Instead you could use ys[t_]:=..... in which case it doesn't
matter if 't' has a global value.  However ys[t_]:=.... is less
efficient.

Cheers,
Ted Ersek


  • Prev by Date: Re: Unexpected results
  • Next by Date: Re: StyleForm
  • Previous by thread: Re: 3-D to 2-D slice revisited
  • Next by thread: Re: 3-D to 2-D slice revisited