MATLAB Answers

I'm trying to convert a 1 dimension lat,lon,data to 2d data without interpolating (without griddata command). Is this possible?

5 ビュー (過去 30 日間)
DIPENDRA007 2021 年 7 月 24 日
編集済み: Chunru 2021 年 7 月 25 日
I have a one dimensional latitude,longitude, data. Essentially all are in one dimension. However I want to create a 2D plot with the data.
So, what I want is the data should be in 2D format without using the griddate which uses interpolation. So, in 2D format of data there should be original value of 1D data present at every original latitude, longitude point and other points it will be NaN or zero.


Chunru 2021 年 7 月 24 日
編集済み: Chunru 2021 年 7 月 25 日
Updated solution:
T1 = readtable('chiranjit Das DAY_1.xlsx');
dg = 1;
longrid = (-180:dg:180);
latgrid = (-90:dg:90);
z = nan(length(latgrid), length(longrid));
for ilat=1:length(latgrid)
for ilon=1:length(longrid)
ii = T1.LATITUDE-latgrid(ilat)>=-dg/2 & T1.LATITUDE-latgrid(ilat)<dg/2 & ...
T1.LONGITUDE-longrid(ilon)>=-dg/2 & T1.LONGITUDE-longrid(ilon)<dg/2;
z(ilat, ilon) = mean(T1.DATA(ii));
imagesc(longrid, latgrid, z);
axis xy
cmap = turbo(1024); cmap = cmap(257:768,:);
ax = axesm('MapProjection','apianus','MapLatLimit',[-90 90], 'MapLonLimit', [-180 180]);
[lon, lat] = meshgrid(longrid, latgrid);
geoshow(ax, lat, lon, z, cmap , 'DisplayType', 'image')
Your description of the problem is not detailed. Is this what you want?
n = 100;
lat = rand(n, 1);
lon = rand(n, 1);
z = rand(n, 1);
stem3(lon, lat, z);
xlabel('lon'); ylabel('lat'); zlabel('z');

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by