0

OK so I have plotted a 3-d graph z = x-y*15/36 on gnuplot but I am trying to find points on this function where both the x and y values are integers I am aware that conditions can be set with the ternary operator but I cannot find any type of comparator or function that would let me set the function to only accept integer x and y values.

I have searched the help in gnuplot and found nothing and an hour search on Google did not help either. Any advice on how to solve this is appreciated, even if I have to use another graphing software.

user1317221_G
  • 15,087
  • 3
  • 52
  • 78

1 Answers1

0

I'm not 100% sure I get what you're asking, but this seems to work:

set xrange [-10:10]
set yrange [-10:10]
set samples 21,21
set isosamples 21,21
splot x-y*15./36. w p

The key is to figure out how many integers there are in your range and set samples and isosamples to that value.

To explain, set samples determines where gnuplot samples the function for plotting. The syntax is set samples NX,NY. In this case, I choose 21 samples, meaning sample at x=-10,x=-9,...,x=0,...,x=9,x=10 and the same for y. That just picks which "isolines are drawn. set isosamples determines how many points are drawn along each line. (again, 21, because I wanted them plotted at x=-10,...,x=10 and the same for y.

mgilson
  • 300,191
  • 65
  • 633
  • 696
  • if you don't mind asking could you explain the code its a bit difficult to understand how it works, but it seems to do what i wanted thank you (i would up vote but it seems i need more rep) – psionicscv Jan 06 '13 at 06:24
  • @psionicscv -- added some explanation. – mgilson Jan 06 '13 at 14:44