フィルターのクリア

How to plot DiscreteGeometry objects

2 ビュー (過去 30 日間)
James Kempton
James Kempton 2020 年 1 月 4 日
編集済み: James Kempton 2020 年 1 月 5 日
In the workspace attached I have a table (opFrame_table), one variable of which is XYZ, each row of this variable representing XYZ data for the centre of the top face of a cylinder.
I have created DiscreteGeometry objects for each row (and therefore cylinder) using multicylinder, and am attempting to plot them using pdegplot. Here is the code:
%% Generate cylinders from markers
R=150;
H=NaN(height(opFrame_table),1);
model=cell(height(opFrame_table),1);
for i=1:height(opFrame_table)
H(i)=opFrame_table.XYZ(i,3);
gm=multicylinder(R,H(i));
model{i}=createpde;
model{i}.Geometry=gm;
pdegplot(model{i})
hold on
end
The result is the figure below (with the .fig file attached):
cylinder.jpg
As you can see only one of the objects is plotted. The position of the object within the coordinate system is also somewhat unrelated to the original XYZ variable data. Each edge of the cylinder is composed of a series of points with X, Y and Z coordinates, however, only the Z data is the same as the original XYZ variable data. Three questions therefore:
  1. How are you able to plot multiple cylinders in the same plot?
  2. How can you access the X, Y and Z coordinates of the edge points of the cylinders?
  3. How can I change the position of the cylinders in the plot?

回答 (1 件)

Ravi Kumar
Ravi Kumar 2020 年 1 月 5 日
Looks like you are overwriting the plot in a loop. If you want to plot multiple figures then you insert: figure command before pdegplot:
...
figure
pdegplot(model{i})
...
  1 件のコメント
James Kempton
James Kempton 2020 年 1 月 5 日
編集済み: James Kempton 2020 年 1 月 5 日
Rather than plotting multiple figures, I would like to plot multiple of the DiscreteGeometry objects (in this case, cylinders) on the same figure. I thought using the hold on command in the above loop would be sufficient but it seems not to be.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeometry and Mesh についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by