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

Surfplot whole numbers

  1. Oct 6, 2012 #1
    I would like my surfplot to only show whole numbers when I use the data cursor tool. Right now when I use the data cursor it shows x=1.058 y=3.5, z=9.5.

    How can I make it so it only evaluates my function over whole numbers, and displays only whole number answers?

    example:

    ezsurf('3*x*y+4*x+3*y+3', [0,100])

    I would like it to only evaluate the function x, 0->100 and y, 0->100 in increments of 1.

    Thank you in advance!!
     
  2. jcsd
  3. Oct 14, 2012 #2
  4. Oct 14, 2012 #3
    Perhaps if you create a 101x101 matrix of values for your expression and find a way to plot that matrix as a surface and then you read this

    http://www.mathworks.com/help/matla...aying-data-values-interactively.html#f4-44251

    where it describes "snapping to the nearest data vertex" then you might be able to accomplish what you are looking for.

    But that is just a wild guess
     
  5. Oct 14, 2012 #4
    thanks for the response. I am going to give it a try.
     
  6. Oct 14, 2012 #5
    No go, it still does stuff like:

    x:11.47
    y:19.1
    z:1.04e04

    Annoying!!!

    I just want it to do whole numbers.
     
  7. Oct 14, 2012 #6
    Did you make a 101x101 matrix of (integer) individual values and then plot that?
    Or did you plot a continuous (real) function 3*x*y+4*x+3*y+3 over 0:100 x 0:100?

    Did you then look at that Matlab web page that tells how to set the mouse pointer to jump to the nearest data point, which should have been some integer x and some integer y?
    Or did you not set the mouse pointer to jump to the nearest (integer) data point?

    I think I understand what you want to do.
    The question is whether you are doing what that web page describes or not.
    Or whether perhaps that web page applies to your problem or not.

    Computers, and software in particular, are annoying. That is life.
     
    Last edited: Oct 14, 2012
  8. Oct 15, 2012 #7
    Ended up doing a for loop to build a matrix. Then using the plot3. It is working correctly now.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Surfplot whole numbers
  1. Random numbers (Replies: 1)

Loading...