MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Group Scattered Data Using a Tolerance


This example shows how to group scattered data points based on their proximity to points
of interest.

Create a set of random 2-D points. Then create and plot a grid of equally spaced points on
top of the random data.

x = rand(10000,2);
[a,b] = meshgrid(0:0.1:1);
gridPoints = [a(:), b(:)];
plot(x(:,1), x(:,2), '.')
hold on
plot(gridPoints(:,1), gridPoints(:,2), 'xr', 'Markersize', 6)

2 Program Components

Free download pdf