0

I have a nxm matrix where n is the number of bins in the x axis and m is the number of bins in the y axis. Each position in the matrix has a number which shows how many data points are in matching x-y bin ranges from my raw data and when surf plotted results in a density plot.

The problem is if I have 100 x-bins and 50 y-bins the axis of my surf plot will be 0-100 on the x-axis and 0-50 on the y-axis. Which makes sense because I am doing surf(Matrix).

But infact I want the x and y axis to be from 0-5 for example. Therefore the number of bins for x and y will determine only the resolution of the plot. Low number of bins = low resolution. High number of bins = high resolution. When for the whole time the axis of the plot are 0-5.

In a nutshell is it possible to plot a matrix of varying size that is used for a surf plot into pre-assigned axis values?

(Of course doing axis([0 5 0 5]) will not work)

Found it difficult to word the question but hopefully it makes sense.

mikkola
  • 3,376
  • 1
  • 19
  • 41
user3536870
  • 249
  • 1
  • 2
  • 13
  • 1
    I'm not entirely sure I understood your question, but are you referring to using given x- and y-axis values to display in the plot? Something like `x = linspace(xmin, xmax, 100); y = linspace(ymin, ymax, 50); surf(x,y, Matrix)` where `xmin,xmax,ymin,ymax` are the min/max values for your data? You can set these to whatever values you want for the plot. – mikkola Nov 11 '15 at 13:41
  • Yes to the first point :) I am not familiar with linspace function but I will look it up in 'help' and let you know how that works! – user3536870 Nov 11 '15 at 13:43
  • Great. `linspace(x1, x2, N)` creates a vector of `N` evenly spaced values between `x1` and `x2`. Of course, you can replace the vectors generated this way by any that are appropriate for your data and locations of your bins as long as the sizes match those of your `Matrix`. – mikkola Nov 11 '15 at 13:47
  • Wonderrrfuulll!!!! Works a treat! :D – user3536870 Nov 11 '15 at 13:55

0 Answers0