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

9 visualizaciones (últimos 30 días)
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 comentarios
Sangesh Pv
Sangesh Pv el 27 de Sept. de 2023
Editada: Sangesh Pv el 27 de Sept. de 2023
% 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 el 27 de Sept. de 2023
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

Iniciar sesión para comentar.

Respuesta aceptada

David Hill
David Hill el 27 de Sept. de 2023
% Step 1: Load Data from Excel
data = readmatrix('subtowersutm.xlsx'); % readmatrix instead of readtable

Más respuestas (0)

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by