How can I plot a mesh?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shahid Iqbal
am 9 Jul. 2015
Beantwortet: Star Strider
am 9 Jul. 2015
I have three variables X,Y and Z, Z is calculated from row vectors of X and Y and then I want to plot a mesh of Z using X and Y as grid... I know how to meshgrid but I dont know how to extend Z vector corresponding to X and Y grid?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 9 Jul. 2015
Use meshgrid to create the ‘X’ and ‘Y’ meshes, then calculate ‘Z’ from them:
x = linspace(-3, 3, 50);
y = linspace(-1.5, 1.5, 30);
[X,Y] = meshgrid(x, y);
Z = sin(X) .* exp(Y);
figure(1)
mesh(X, Y, Z)
grid on
Note the use of element-wise multiplication (.*) in ‘Z’.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!