How to convert lat lon to utm data and plot it in 10x10m^2 grid map.

9 ビュー (過去 30 日間)
Sangesh Pv
Sangesh Pv 2023 年 9 月 27 日
コメント済み: Sangesh Pv 2023 年 9 月 28 日
Hi, i have a task where i have to make a 10x10m^2 grid plot in a map with utm coordinates i have all my data in lat lon in excel file,
Then you scan the pixels and for each pixel you can store the measurements falling within the current pixel (you can use in polygon function in Matlab). The idea is then to compute the average RSRP for each pixel (average computed by first transforming the dBm measurements into watt, then compute the average and then compute dBm from average).
The goal will be then to plot a heatmap of average RSRP over the territory.
You can start with pixel size of 10 x 10 m^2, keeping in mind that this parameter could be varied depending on the outcome that we see (hence put it in a variable of the script).
can anyone help me out with it i am getting error in my code.
  2 件のコメント
Sangesh Pv
Sangesh Pv 2023 年 9 月 27 日
編集済み: Sangesh Pv 2023 年 9 月 27 日
% Step 1: Load Data from Excel
data = readtable('subtowersutm.xlsx');
% Extract latitude, longitude, and RSRP values.
measurement_lat = data(:, 1);
measurement_lon = data(:, 2);
rsrp = data(:, 11); % Adjust the column index for RSRP data.
% Check if the dimensions of Lat and Lon match
if size(measurement_lat) ~= size(measurement_lon)
error('Latitude and Longitude dimensions do not match.');
end
% Define the UTM zone for your area.
utm_zone = 32;
% Step 2: Transform Coordinates using the built-in 'deg2utm' function
[utm_x, utm_y, utm_zone] = deg2utm(measurement_lat, measurement_lon);
% Define the pixel size and create the grid
pixel_size = 10; % Adjust as needed
x_grid = min(utm_x):pixel_size:max(utm_x);
y_grid = min(utm_y):pixel_size:max(utm_y);
% Step 3: Calculate average RSRP for each pixel
num_pixels_x = numel(x_grid) - 1;
num_pixels_y = numel(y_grid) - 1;
average_rsrp = zeros(num_pixels_y, num_pixels_x); % Initialize the grid.
for i = 1:num_pixels_x
for j = 1:num_pixels_y
% Define the current pixel polygon.
polygon_x = [x_grid(i), x_grid(i + 1), x_grid(i + 1), x_grid(i)];
polygon_y = [y_grid(j), y_grid(j), y_grid(j + 1), y_grid(j + 1)];
% Check if measurements fall within the current pixel.
in_polygon = inpolygon(utm_x, utm_y, polygon_x, polygon_y);
% Calculate average RSRP for the measurements within the polygon.
if any(in_polygon)
rsrp_values_in_polygon = rsrp(in_polygon); % Replace with your RSRP data.
% Convert dBm to watts, compute average, and convert back to dBm.
rsrp_watts = 10 .^ (rsrp_values_in_polygon / 10);
average_rsrp(j, i) = 10 * log10(mean(rsrp_watts));
end
end
end
% Step 4: Plot the heatmap of average RSRP
% You can use various plotting functions to visualize the heatmap.
heatmap(x_grid(1:end-1), y_grid(1:end-1), average_rsrp);
colorbar;
xlabel('UTM X');
ylabel('UTM Y');
title('Average RSRP Heatmap');
Sangesh Pv
Sangesh Pv 2023 年 9 月 27 日
Error using tabular/length
Undefined function 'LENGTH' for input arguments of type 'table'. Use the height, width, or size functions instead.
Error in deg2utm (line 51)
n1=length(Lat);
how can i fix this

サインインしてコメントする。

採用された回答

David Hill
David Hill 2023 年 9 月 27 日
% Step 1: Load Data from Excel
data = readmatrix('subtowersutm.xlsx'); % readmatrix instead of readtable
  1 件のコメント
Sangesh Pv
Sangesh Pv 2023 年 9 月 28 日
thanks it worked and how can i get the output in a map.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMap Display についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by