How can I plot a mesh?

13 次查看(过去 30 天)
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?

采纳的回答

Star Strider
Star Strider 2015-7-9
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 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by