Creating of Basic Shape in Matlab
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sergey Dukman
le 17 Mai 2015
Commenté : Star Strider
le 17 Mai 2015
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
0 commentaires
Réponse acceptée
Star Strider
le 17 Mai 2015
Modifié(e) : Star Strider
le 17 Mai 2015
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Geometry and Mesh dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!