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

Mathematica - Countour plot problem

  1. Jun 10, 2015 #1
    Hello! I'm trying to plot some eigenfunctions (for a semicircle) in Mathematica. Functions are of the following form:
    $$g_{ms}=J_{2m+1}(y_{ms}x) sin ((2m+1)\varphi)$$
    For example, for m=0 and s=1 it should look like what I drew in the attached file "Snapshot". Well, I don't have much experience with Mathematica and the "code" I wrote so far doesn't give me the right result.
    Here's my try:
    Code (Matlab M):

    m = 0;
    s = 1;
    dat = Table[{x = RandomReal[{-1, 1}], y = RandomReal[{0, 1}],
        BesselJ[(2*m + 1), BesselJZero[m, s]*x]*
         Sin[(2*m + 1)*ArcTan[x, y]]}, {1000}];
    ListContourPlot[dat]
     
    The plot I get is in the attached file "Wrongplot". What am I doing wrong?
     

    Attached Files:

    Last edited by a moderator: Jun 10, 2015
  2. jcsd
  3. Jun 12, 2015 #2

    RUber

    User Avatar
    Homework Helper

    It seems like you might be using the wrong coordinates. Could this be the polar form?
    Where you have x in ##g_{ms} = J_{2m+1}(y_{ms} x) \sin ((2m+1)\varphi)##, you might try using r = ##\sqrt(x^2+y^2)##.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica - Countour plot problem
Loading...