How to find (0,0) in a meshgrid?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Julian Blackthorne
am 1 Sep. 2021
Bearbeitet: Julian Blackthorne
am 1 Sep. 2021
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 Kommentar
Akzeptierte Antwort
KSSV
am 1 Sep. 2021
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')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!