pick up the regular grid out of scattered data

I have a (2,1) matric which is (x,y) coordinates of a scattered data (a mixture of a regular grid and an irregular grid). The regular grid is a square grid at 5mm +/- 0.005 intervals in x and y. I want to pick up the regular grid out of the mixed grid. Any idea? Thanks

4 Kommentare

Guillaume
Guillaume am 10 Okt. 2014
Is there an unknown offset of the regular grid, or do you know for sure that points will be at k*5 +/- 0.005 ?
Asl
Asl am 10 Okt. 2014
points of regular grid are laying with 5 mm in x and 5 mm in y with 0.005 mm tolerence. This grid i want to pick it out
Yes, I understood that the points are spaced 5 mm apart. That is
x == 5*k + x0 (+/-0.005)
y == 5*k + y0 (+/-0.005)
k integer
The question was: are x0 and y0 known or not? The problem is considerably easier if they are.
Asl
Asl am 10 Okt. 2014
yes x0 and y0 are known
regular grid points look like this: 112520.307 117520.305 122520.311 127520.308 example difference: 5000.002

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Guillaume
Guillaume am 10 Okt. 2014

0 Stimmen

If x0 and and y0 are known, then you just take the modulo of your x and y (minus the origin offset) by 5 and check that it is smaller than 0 + tolerance or greater than 5 - tolerance:
%scatterpoints = 2x1 array of scattered data
scatterx = scatterpoints(1, :) - x0;
scattery = scatterpoints(2, :) - y0;
tolerance = 0.005;
isreggridx = mod(scatterx, 5) < tolerance | mod(scatterx, 5) > 5 - tolerance;
isreggridy = mod(scattery, 5) < tolerance | mod(scattery, 5) > 5 - tolerance;
reggridpoints = scatterpoints(:, isreggridx & isreggridy)

Gefragt:

Asl
am 10 Okt. 2014

Beantwortet:

am 10 Okt. 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by