How to generate distincted distanced coordinates?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
kahlan hasan
le 24 Nov 2022
Commenté : kahlan hasan
le 25 Nov 2022
I would like to generate the following coordinates :
x = [0 50 100 ...1000], y=[0 50 100 ... 1000], such that the first coordinate is [x = 0 y =0], second coordinate is [x = 50 y=0], .. and so on until [x=1000 y=0] and then the same for y.
any help?
0 commentaires
Réponse acceptée
Florian Bidaud
le 24 Nov 2022
x = [0:50:1000];
y = [0:50:1000];
[xGrid,yGrid] = meshgrid(x,y);
3 commentaires
Florian Bidaud
le 25 Nov 2022
Modifié(e) : Florian Bidaud
le 25 Nov 2022
xGrid and yGrid are exactly the grid you want. I reduced the size for visibility.
x = [0:50:200];
y = [0:50:200];
[xGrid,yGrid] = meshgrid(x,y)
If you want to combine them in a cell array for example :
for i = 1:length(xGrid)
for j = 1:length(yGrid)
cellArray{i,j} = [xGrid(i,j) yGrid(i,j)];
end
end
disp(cellArray)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!