Depth Label of 3D Graph (Cylinder)

1 回表示 (過去 30 日間)
Raysan Alhamoud
Raysan Alhamoud 2018 年 1 月 31 日
回答済み: Benjamin Kraus 2018 年 2 月 1 日
I'm trying to graph a borehole using a set of depths and their respective diameters. I tried graphing it using:
r = [5,7,4,6,8,6,5,5,7,8]; [X,Y,Z]=cylinder(r); Surf(X,Y,X)
Which gave me a graph showing the diameters "r" on the x-y plane, but the z axis is always set to 1 (endpoints 0 to 1). How can I assign depths to each diameter of the graph.
e.g. (Z = [0,1,2,3,4,5,6,7,8,9])

回答 (1 件)

Benjamin Kraus
Benjamin Kraus 2018 年 2 月 1 日
I would recommend ignoring the Z output from cylinder and just creating your own using meshgrid or ndgrid.
r = [5,7,4,6,8,6,5,5,7,8];
depths = [0,1,2,3,4,5,6,7,8,9];
[X,Y]=cylinder(r');
[~,Z] = meshgrid(1:size(X,2),depths);
[~,C] = meshgrid(1:size(X,2),r); % Color based on radius
surf(X,Y,Z,C)
If the data is upside down, just flip depths before calling meshgrid:
r = [5,7,4,6,8,6,5,5,7,8];
depths = [0,1,2,3,4,5,6,7,8,9];
[X,Y]=cylinder(r');
[~,Z] = meshgrid(1:size(X,2),flip(depths));
surf(X,Y,Z)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by