How to generate a 2D meshgrid based on the coordinates (longitude and latitude) of points
21 次查看(过去 30 天)
显示 更早的评论
I have several points' coordinates, I want to merge a meshgrid of the points looks like the following figure.
For example, I have five points with coordinates info, the ideal generated meshgrid should be like this (the purple square which is overshadowed).
Thank you very much!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1038120/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1038120/image.jpeg)
0 个评论
采纳的回答
Voss
2022-6-19
xy = [1 3; 2 9; 6 6; 8 8; 9 1];
% [xx,yy] = meshgrid(sort(xy(:,1)),sort(xy(:,2))) % note: maybe you want to sort x and y first
[xx,yy] = meshgrid(xy(:,1),xy(:,2))
plot(xy(:,1),xy(:,2),'ok','MarkerFaceColor','k')
hold on
xline(xx(1,:))
yline(yy(:,1))
xlim([0 10]);
ylim([0 10]);
set(gca(),'Visible','off')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!