Info

此问题已关闭。 请重新打开它进行编辑或回答。

how to form a 3D surface with several points whose coordinate in x,y,z axis is known

1 次查看(过去 30 天)
X = [0 5 0 5 2.5 0.417 2.5 4.58 0.417 2.5 4.58 2.5] Y = [0 0 5 5 0.154 1.668 1.698 1.668 3.33 3.30 3.33 4.845] Z = [0 2 2 0 1 0.68 1 1.3125 1.3125 1 1.6875 1] %% these are the coordinates given, i want to make surface using above coordinates thanks in advance

回答(1 个)

Star Strider
Star Strider 2017-11-18
One approach (using griddata interpolation):
X = [0 5 0 5 2.5 0.417 2.5 4.58 0.417 2.5 4.58 2.5];
Y = [0 0 5 5 0.154 1.668 1.698 1.668 3.33 3.30 3.33 4.845];
Z = [0 2 2 0 1 0.68 1 1.3125 1.3125 1 1.6875 1];
Xq = linspace(min(X(:)), max(X(:)), 20);
Yq = linspace(min(Y(:)), max(Y(:)), 20);
[Xg,Yg] = meshgrid(Xq, Yq);
Zg = griddata(X, Y, Z, Xg, Yg);
figure(1)
surfc(Xg, Yg, Zg)
grid on

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by