Making mesh from independent variables
Mostra commenti meno recenti
I have three variables as vectors (X,Y,Z). They are Longitude, latitude and Depth, respectively. I wanna create a wireframe mesh form these data. In case of my data the variable Z isn't a function of X and Y (i.e. it's an independent variable form X and Y), I can't get Z as a matrix. How can I make a matrix from vector Z, and grid my data to create mesh or surface? Please help me to write this code.I need it vitally. I tried "mesh" and "griddata", but there is something wrong with my code. Thanks in advance,
X=(44:0.30:49); Y=(34:0.30:39); Z=(rand(1,17))*1000; [X1,Y1]=meshgrid(X,Y);
Risposte (2)
Chirag Gupta
il 13 Lug 2011
[x,y,z] = meshgrid(X,Y,Z); % Where X,Y and Z are vectors
1 Commento
Ali Y.
il 13 Lug 2011
Sean de Wolski
il 13 Lug 2011
doc griddata
doc triscatteredinterp
to get your irregular mesh to a regular one.
Z has to be 17x17 to have a combination for each point in X,Y, it's currently 1x17. Are you sure you don't want:
plot3(X,Y,Z)
?
3 Commenti
Ali Y.
il 13 Lug 2011
Sean de Wolski
il 13 Lug 2011
it should be
Z1 = reshape(griddata(X(:),Y(:),Z(:),X1(:),Y1(:)),size(X1));
Ali Y.
il 13 Lug 2011
Categorie
Scopri di più su Map Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!