필터 지우기
필터 지우기

How do i count the flashes of a lightning discharge within my time of interest and plot them in per square km ?? I want the plot to look like this(capture.jpg --attached below).

조회 수: 6 (최근 30일)
I have the data of lightning discharges around a location (say, South Africa). I have the latitude and longitude of the flashes occurring over this region. How do I plot them on map, to know their flash density ?? Anyone please help formulate a matlab code to know the no. of flashes per square kilometer.

채택된 답변

Chad Greene
Chad Greene 2016년 3월 17일
The first step is to convert lat,lon to some projected x,y values because lats and lons are not equally spaced. If you have the Mapping Toolbox you can use projfwd for the coordinate transformation.
When you have the coordinates in x,y space, then it's just a matter of creating a 2D histogram to get lightning strike density. You can search the File Exchange site for 2D histogram functions that others have already created. Or you could manually create a 2D histogram by creating a grid, then in a loop you could determine the sum of x,y values that are within the bounds of each grid cell. Here's an example:
x = 20*randn(300,1);
y = 10*randn(300,1)+x/3;
plot(x,y,'rx')
axis equal;
gridres = 10;
xgrid = -100:gridres:100;
ygrid = -50:gridres:50;
% Preallocate a histogram:
hist2 = NaN(length(ygrid),length(xgrid));
for row = 1:length(ygrid)-1
for col = 1:length(xgrid)-1
% Get indices of all x,y points inside this grid cell:
ind = x>=xgrid(col)-gridres/2 & x<xgrid(col+1)-gridres/2 & y>=ygrid(row)-gridres/2 & y<ygrid(row+1)-gridres/2;
%
% Log the sum of number of lighting strikes inside the grid cell:
hist2(row,col) = sum(ind);
end
end
%
hold on
h = imagesc(xgrid,ygrid,hist2/(gridres^2));
uistack(h,'bottom')

추가 답변 (1개)

kaustubh ahirrao
kaustubh ahirrao 2021년 3월 28일
x = 20*randn(300,1);
y = 10*randn(300,1)+x/3;
plot(x,y,'rx')
axis equal;
gridres = 10;
xgrid = -100:gridres:100;
ygrid = -50:gridres:50;
% Preallocate a histogram:
hist2 = NaN(length(ygrid),length(xgrid));
for row = 1:length(ygrid)-1
for col = 1:length(xgrid)-1
% Get indices of all x,y points inside this grid cell:
ind = x>=xgrid(col)-gridres/2 & x<xgrid(col+1)-gridres/2 & y>=ygrid(row)-gridres/2 & y<ygrid(row+1)-gridres/2;
%
% Log the sum of number of lighting strikes inside the grid cell:
hist2(row,col) = sum(ind);
end
end
%

카테고리

Help CenterFile Exchange에서 Geometric Geodesy에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by