Hello , I am a student of electrical engineering. I'm new here, I'm trying to model the magnetic field inside a toroid . But I'm finding it very difficult to do so. The code below is an example already compiled a code I found on the internet , but when I copied the code to a new nb and tried to run it accused the compiler error. Someone could test and tell me what 's wrong? the result should be a magnetic field composed of arrows
bfieldp = {0, 0,
1/(2*\[Pi]*
r)}(*This is the simplified expression for magnetic field, in \
spherical coordinates *)
bCartp = TransformedField["Spherical" -> "Cartesian",
bfieldp, {r, \[Theta], \[CurlyPhi]} -> {x, y,
z}] (*Here, I convert the spherical expression for B to \
cartesian, since that is what VectorPlot3D takes as input*)
bzero = (Piecewise[{{1, 2.5 < Sqrt[x^2 + y^2 + z^2] < 3.8}}, 0])
fullp = Show[
VectorPlot3D[(bCartp*bzero), {x, -3.5, 3.5}, {y, -3.5,
3.5}, {z, -3.5, 3.5}, ViewPoint -> Above] ]