Creating of Basic Shape in Matlab

2 次查看(过去 30 天)
Hello!
I am trying to create a rectangle as a basic shape. I use these commands:
rect=[3 4 -1 1 1 -1 -0.5 -0.5];
gd=[rect];
ns=char('rect');
sf='rect';
dl = decsg(gd,sf,ns)
But in the end I get the following error message:
Index exceeds matrix dimensions.
What is wrong with my script? I do not fully understand what the following sentences means: "3 through 6 - x-coordinate of edge starting points" and "7 through 10 - y-coordinate of edge starting points"(from MATLAB help desk). Would somebody explain me this?
I want to get a solid geometry. 'decsg' means Decompose Constructive Solid Geometry into minimal regions. I follow this example http://se.mathworks.com/help/pde/ug/create-geometry-at-the-command-line.html but cannot get a shape.
Sergey

采纳的回答

Star Strider
Star Strider 2015-5-17
编辑:Star Strider 2015-5-17
I don’t have much recent experience with the PDE Toolbox, but your ‘rect’ assignment is missing the last two y-coordinates for your rectangle:
rect=[3 4 -1 1 1 -1 -0.5 -0.5 # #];
where the ‘#’ indicate the missing coordinates.
In the documentation for Create CSG Geometry at the Command Line, the ‘3 through 6’ and ‘7 through 10’ refers to the vector needing four x (in elements 3-6) and four y (in elements 7-10) coordinates to define the rectangle’s corners.
EDIT — The error, ‘Index exceeds matrix dimensions.’ means that the relevant PDE routine is looking for the last two elements in your ‘rect’ vector and can’t find them.
  2 个评论
Sergey Dukman
Sergey Dukman 2015-5-17
Hello!
Thank you, Sir.
now it is understandable. I will try all over again.
Sergey

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by