Surfplot Whole Numbers: Using the Data Cursor Tool

  • Thread starter Thread starter johnkubik
  • Start date Start date
  • Tags Tags
    Numbers
Click For Summary

Discussion Overview

The discussion revolves around how to configure a surfplot in MATLAB to display only whole numbers when using the data cursor tool. Participants explore methods for evaluating a function over whole numbers and displaying results accordingly, focusing on both theoretical and practical aspects of MATLAB plotting.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant seeks a method to ensure that the data cursor in a surfplot only shows whole number values for x, y, and z coordinates.
  • Another suggests creating a 101x101 matrix of values for the expression and refers to MATLAB documentation on data cursor functionality, implying that snapping to the nearest data vertex might help achieve the desired outcome.
  • A participant expresses frustration that their current approach still yields non-integer values, indicating a need for a solution that strictly adheres to whole numbers.
  • Further inquiry is made about whether the participant has implemented the suggested matrix approach and if they have configured the data cursor settings as described in the MATLAB documentation.
  • A later reply mentions successfully using a for loop to build a matrix and employing the plot3 function, indicating a resolution to their issue.

Areas of Agreement / Disagreement

There is no consensus on a single solution, as participants explore different methods and express varying levels of success with their approaches. Some suggestions remain untested or unresolved.

Contextual Notes

Participants discuss the limitations of their approaches, including the potential need for specific configurations in MATLAB and the challenges of ensuring integer outputs from a continuous function.

johnkubik
Messages
15
Reaction score
0
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!
 
Physics news on Phys.org
Bump?
 
thanks for the response. I am going to give it a try.
 
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.
 
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:
Ended up doing a for loop to build a matrix. Then using the plot3. It is working correctly now.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
9K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K