Creating a meshgrid of nodes
Afficher commentaires plus anciens
Hello everyone, i would like to create a meshgrid in x-y axis, lets say for example a 9x9 grid. now i want to give values to each of the 81 nodes created in order to connect one node to the adjacent one that has the biggest value and so on unti i reach a final node..
Réponse acceptée
Plus de réponses (1)
Making mesh grid is straight forward in MATLAB. YOu have to give initial and final points with the number of points you want in between.
Eg:
P0 = [0 0] ; % initial point
P1 = [1 1] ; % final point
N = 9 ; % Number of points
x = linspace(0,1,N) ;
y = linspace(0,1,N) ;
[X,Y] = meshgrid(x,y) ;
If you want to assign a value to each node; define a 9x9 matrix..the respective indices (i,j) represent the value of (i,j)th node in X and Y.
Eg:
K = rand(9,9) ; % random data
surf(X,Y,K) ;
1 commentaire
Alexios Ioannidis
le 19 Sep 2016
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!