How to create a gridded matrix with N equally spaced points?

32 vues (au cours des 30 derniers jours)
matlabkid602
matlabkid602 le 25 Juil 2017
Commenté : Stephen23 le 25 Juil 2017
I am trying to create a coordinate grid with equally spaced rows of N data points in the format of X and Y values.
How can I specify this in terms of maximum and minimum values ofX and Y values I want, so that I can create a table of points?
  1 commentaire
Stephen23
Stephen23 le 25 Juil 2017
doc colon
doc linspace
doc ndgrid

Connectez-vous pour commenter.

Réponse acceptée

dbmn
dbmn le 25 Juil 2017
I would advise to use one of the following for the grid
[X,Y] = meshgrid(x,y); % with x y being the vectors of your choice
[X2,Y2] = = ndgrid(x1,x2) % with x1 x2 vectors
to create the vectors x and y you could use any of the following
x = min_value:increment:max_value;
% or
x1 = linspace(x1_min,x1_max,number_of_values)

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by