Re: cylindrical vector plot
- To: mathgroup at smc.vnet.net
- Subject: [mg28503] Re: cylindrical vector plot
- From: Adam Smith<adam.smith at hillsdale.edu>
- Date: Sun, 22 Apr 2001 21:03:19 -0400 (EDT)
- References: <9btr4f$1ua@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Julian,
If I understand what you want to do, the following code may do what you want.
The basic idea is to take a vector in cylindrical coordinates with unit vectors
"rhat", "phihat" and "zhat" and transform it into Cartesian coordinates with
unit vectors "xhat" = {1,0,0}, "yhat" = {0,1,0} and "zhat" = {0,0,1}. You
construct a suitable list of points and associated vectors. The command
ListPlotVectorField3D from the PlotField3D package (what a long name) can
display this table of vectors you created.
In the code below, I have set is up so that you can define functions f,g and h
such that your cylindrical coordiante vector is {f*rhat, g*phihat, h*zhat}. For
your case I let f=0. So there is no "rpart" of the resulting vector field.
I find that these 3-D vector plots are often hard to interpret without some
work. I have included some plots that I think should show the major features
one is trying to see from the plots.
Adam Smith
In[2]:=
<<Graphics`PlotField3D`
In[3]:=
<<Calculus`VectorAnalysis`
In[4]:=
Off[General::spell1];
In[5]:=
rhat = Cos[phi]*{1, 0, 0} + Sin[phi]*{0, 1, 0};
phihat = -Sin[phi]*{1, 0, 0} + Cos[phi]*{0, 1, 0};
zhat = {0, 0, 1};
In[8]:=
f = 0;
g = 1/(1 + r);
h = Exp[-r];
vec = f*rhat + g*phihat + h*zhat;
In[12]:=
vectorlist = Flatten[
Table[ {{ r Cos[phi], r Sin[phi], z}, vec}, {z, 0, 1}, {r, 0.5, 2,
0.5}, {phi, 0, 2 Pi - Pi/4, Pi/4}],
2];
In[13]:=
ListPlotVectorField3D[vectorlist, VectorHeads -> True, Axes -> True,
ViewPoint -> {3.224, 1.060, 0}];
In[14]:=
ListPlotVectorField3D[vectorlist, VectorHeads -> True, Axes -> True,
ViewPoint -> {3.224, 1.060, 5}];
In article <9btr4f$1ua at smc.vnet.net>, Julian Sweet says...
>
> I am trying to create a 3D vector field plot, but in
>cylindrical coordinates. My vector equation has two components, "phi"
>and "z". Both of these components are dependent on radius, "r". I
>guess I'm trying to figure out how to graph this in cylindrical
>coordinates, as plotfield3D assumes cartesian coordinates. Ultimately
>I would end up with a cylindrical vector field plot with arrows
>pointing in some "phi" and "z" direction -- each arrow's magnitude and
>direction is dependent upon r....
>
>
>
>email response appreciated: jsweet at engineering.ucsb.edu
>