How to find (0,0) in a meshgrid?
3 次查看(过去 30 天)
显示 更早的评论
Is there a way to find the origin (0,0), without using a for loop for the meshgrid generated below?
ii = -15:15
jj = -10:10
[a,b] = meshgrid(ii,jj);
figure(1)
scatter(a(:), b(:), '.', 'k');
1 个评论
采纳的回答
KSSV
2021-9-1
x = -10:1:10 ;
y = -5:1:5 ;
[X,Y] = meshgrid(x,y) ;
idx = knnsearch([X(:) Y(:)],[0 0]) ;
plot(X,Y,'.r')
hold on
plot(X(idx),Y(idx),'ob')
更多回答(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!