Message Boards Message Boards

0
|
3120 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

VectorPlot3D stuck

Posted 11 years ago
Hi guys, I am trying to plot the following functio as a vector field in 3D <pre>Piecewise[{{{(3*z*(1 - z^2/(x^2 + y^2 + z^2))*Log[ro/ri]*<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sin[\[x, y, z]])/(4*Sqrt[x^2 + y^2 + z^2]), <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3/4)*(1 - z^2/(x^2 + y^2 + z^2))^(3/2)*Log[ro/ri]*<br>&nbsp;&nbsp;&nbsp;&nbsp; Sin[\[x, y, z]], (3/4)*(1 - z^2/(x^2 + y^2 + z^2))*<br>&nbsp;&nbsp;&nbsp;&nbsp; Cos[\[x, y, z]]*Log[ro/ri]}, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sqrt[x^2 + y^2 + z^2] &lt; ri}, <br>&nbsp;&nbsp;&nbsp;&nbsp; {{(z*(-(z^2/(6*(x^2 + y^2 + z^2))) + (1 - <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z^2/(x^2 + y^2 + z^2))*(-(5/12) - (1/8)*(1 + <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ri^2/(x^2 + y^2 + z^2))*Cos[2*ArcTan[x, y]] + <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (3/4)*Log[ro/Sqrt[x^2 + y^2 + z^2]]))*<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sin[\[x, y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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ri &lt; Sqrt[x^2 + y^2 + z^2] &lt; ro}}, 0]</pre>Then I try to plot it using:<pre class="mcode_edit">vecs = VectorPlot3D[Bfield, {x, -4, 4}, {y, -4, 4}, {z, -4, 4}]</pre>But nothing comes out. I'm not sure why it is behaving this way. Any suggestions would be really appreciated. Thanks
POSTED BY: Ti Xu
Please try to post a cleaner version of the code.

See http://community.wolfram.com/groups/-/m/t/151347  for how to enter code in code blocks.
POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract