MATLAB: Plotting grid of square points inside a circle of given radius

gridmatrix array

Hi,
I am trying to create a meshgrid of points using MATLAB which has circular aperture. I know that one can generate and X and Y grid of points in MATLAB and it can be square grid of rectangular grid depending on the number of points in X and Y coordinates. But how to draw a grid of points which is neither rectangular nor square, rather it is bounded by a 'circular aperture'.
I have tried to illustrate the concept in the picture.

Best Answer

I'd create your grid of points, define the points of your circle, then use inpolygon to identify just the points that are inside your circle, and use that to determine which points to plot.
Related Question