# How to locate a specific point within a grid system?

조회 수: 27 (최근 30일)
Ashfaq Ahmed 2023년 9월 19일
답변: Walter Roberson 2023년 9월 19일
Hi all,
I have an interesting problem where I am stuck for the last couple of days. So, any feedback from you will be highly appreciated!
Suppose I have a stereographic grid system of 161x161 size, where
x_stereo = -2000000:25000:2000000';
y_stereo = -2000000:25000:2000000;
Now, I want to locate the trajectory of a tracer within this grid system. The trajectory locations are attached in the Location.mat file. The Location variable is a 288x2 matrix where each column represents longitude and latitude, respectively.
lon = [188632.43 188717.44 188799.71 188877.75, etc];
lat = [206775.27 206798.93 206822.16 206846.30, etc];
The challenge is that the values of the latitude and longitudes are different from the grid points. Therefore, we first need to change the values of the lat/lon closest to the grid point's values. For example, the first element of longitude is 188632.43. Now, we need to change it to 200000 because this is the closest value in the grid. Similarly, the second element of longitude is 188717.44; it should be changed to 200000 as well so that it matches what is already there in the grid points.
I want the indices selected in the grid system that will tell me where were the trajectories in the grid. Can anyone please help me with this problem? I am thanking you in advance.

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Walter Roberson 2023년 9월 19일
It sounds to me as if you should have a look at discretize -- which works fine if you can separate the two coordinates.
If you were mapping back and forth grids with equal-spaced latitude + longitude measurements, versus grids based on equal-spaced physical distance measurements (such as 100 m intervals) then the situation would be more complex

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Array Geometries and Analysis에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by