Creating a meshgrid of nodes
Ältere Kommentare anzeigen
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..
Akzeptierte Antwort
Weitere Antworten (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 Kommentar
Alexios Ioannidis
am 19 Sep. 2016
Kategorien
Mehr zu Graphics Performance finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!