필터 지우기
필터 지우기

Creating of Basic Shape in Matlab

조회 수: 2 (최근 30일)
Sergey Dukman
Sergey Dukman 2015년 5월 17일
댓글: Star Strider 2015년 5월 17일
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
Star Strider
Star Strider 2015년 5월 17일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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