Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

SphericalPlot3D with List

  1. Aug 28, 2011 #1
    Hello.
    SphericalPlot3D can build 3d plot only if arguments are : function (theta,phi) and theta's and phi's ranges.
    Is there an opportunity to use SphericalPlot3D or smth like that, if i have a list of points, {z,theta,phi}?
    Thanks!
     
  2. jcsd
  3. Aug 28, 2011 #2

    Dale

    Staff: Mentor

    Just interpolate your list to get a function, then use SphericalPlot3D as normal.
     
  4. Aug 29, 2011 #3
    data = {
    {4.27126*10^-2, 0.05, 0.05}, {4.23865*10^-2, 0.05, 0.1},
    {4.18468*10^-2, 0.05, 0.15}...
    };

    func = Interpolation[data];

    SphericalPlot3D[ func[x, y], {x, 0, Pi}, {y, 0, 2 Pi}, PlotPoints -> 100, PlotRange -> Full]

    An error is "Interpolation::indim: The coordinates do not lie on a structured \
    tensor product grid. >>"
     
  5. Aug 29, 2011 #4

    Dale

    Staff: Mentor

    Did you read the online help for Interpolation and Interpolation::indim? How do they say the data must be structured?
     
  6. Aug 29, 2011 #5
    i did.

    here is two results: 1) ListPlot3D 2) the same plot but after interpolation of list.

    [PLAIN]http://i038.radikal.ru/1108/95/8863f173203b.jpg [Broken]

    ListPlot3D[data, PlotRange -> All]
    func = Interpolation[data];
    func[3.7, 1.6]; <- it works great
    Plot3D[func[x, y], {x, 0, Pi/2}, {y, 0, 2 Pi}, PlotRange -> All]
     
    Last edited by a moderator: May 5, 2017
  7. Aug 29, 2011 #6

    Dale

    Staff: Mentor

    Looks like the data is structured correctly for ListPlot3D, but not for Interpolation. Note that interpolation requires a different input than ListPlot3D. Also, note that you will better able to see problems by specifying the same plot range for both. That will help you distinguish between format errors and interpolation errors. It looks like a format error to me, but due to the scale it is not possible to rule out interpolation errors also.
     
    Last edited: Aug 29, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: SphericalPlot3D with List
  1. Lists in mathematica (Replies: 4)

  2. Problem with lists (Replies: 1)

Loading...