![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176975/image.png)
Grid search to over lap two data sets
1 次查看(过去 30 天)
显示 更早的评论
Hello everybody I was trying to use data after merging it in grid data-1 lat lon s 20.3250 50.1234 1.0000 21.3690 51.2365 21.0000 23.6987 52.6398 36.0000 24.6980 53.6987 65.0000 25.1456 56.2583 62.0000 26.6987 54.2146 35.0000 23.6589 52.3655 24.0000 25.6358 58.9654 15.0000 22.5698 57.3698 15.0000
data-2
lat lon s 20.3610 50.1594 1.5000 21.4050 51.2725 21.5000 23.7347 52.6758 36.5000 24.7340 53.7347 65.5000 25.1816 56.2943 62.5000 26.7347 54.2506 35.5000 23.6949 52.4015 24.5000 25.6718 59.0014 15.5000 22.6058 57.4058 15.5000
Now I want to use nearest nhbaour so that I want grid data with lets say 0.01 degree and anything in or at the boundaries of grid will fall inside the grid. ignoring third column which can be the smartest approach to do this?
Thanks, Amb
0 个评论
采纳的回答
Chad Greene
2015-5-20
I'm not sure if I'm interpreting your data correctly--it starts with "lat lon s" followed by a string of numbers. Do you mean
d1=[20.3250 50.1234 1.0000;
21.3690 51.2365 21.0000;
23.6987 52.6398 36.0000;
24.6980 53.6987 65.0000;
25.1456 56.2583 62.0000;
26.6987 54.2146 35.0000;
23.6589 52.3655 24.0000;
25.6358 58.9654 15.0000;
22.5698 57.3698 15.0000];
%
d2=[20.3610 50.1594 1.5000;
21.4050 51.2725 21.5000;
23.7347 52.6758 36.5000;
24.7340 53.7347 65.5000;
25.1816 56.2943 62.5000;
26.7347 54.2506 35.5000;
23.6949 52.4015 24.5000;
25.6718 59.0014 15.5000;
22.6058 57.4058 15.5000];
where column 1 is lat, column 2 is lon, and column 3 is your measured data? If so, there are a number of ways you can do this. If you want to associate round measurement station locations to the nearest hundredth-degree, you can get the latitudes of dataset 1 by
lat1 = round(100*d1(:,1))/100
=20.3300
21.3700
23.7000
24.7000
25.1500
26.7000
23.6600
25.6400
22.5700
[d1_grid,lon,lat] = gridfit(d1(:,2),d1(:,1),d1(:,3),50.1:.1:59.1,20.3:.1:26.8);
d2_grid = gridfit(d2(:,2),d2(:,1),d2(:,3),50.1:.1:59.1,20.3:.1:26.8);
figure
subplot(321)
pcolor(lon,lat,d1_grid)
shading interp
hold on
plot(d1(:,2),d1(:,1),'rp')
title('d_1','backgroundcolor','w','vert','top')
borders('countries','k','nomap')
subplot(322)
pcolor(lon,lat,d2_grid)
shading interp
hold on
plot(d2(:,2),d2(:,1),'rp')
borders('countries','k','nomap')
title('d_2','backgroundcolor','w','vert','top')
subplot(3,2,3:6)
pcolor(lon,lat,d2_grid-d1_grid)
shading interp
title('d_2 - d_1','backgroundcolor','w','vert','top')
borders('countries','k','nomap')
labelborders('countries','nomap')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/176975/image.png)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!