no puedo encontrar el centroide del triangulo ayuda¡¡¡ ( polyshape/centroid/triangle)
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ricardo Guzmán
el 10 de Ag. de 2020
Respondida: Rishabh Mishra
el 4 de Sept. de 2020
Insufficient number of outputs
from right hand side of equal
sign to satisfy assignment.
x1 = [0 1 2];
y1 = [0 1 0];
x2 = [2 3 4];
y2 = [1 2 1];
polyin = polyshape({x1,x2},{y1,y2});
[x,y] = centroid(polyin);
plot(polyin)
hold on
plot(x,y,'r*')
hold off
3 comentarios
Rik
el 11 de Ag. de 2020
I can't reproduce your issue. Do you have any custom functions or variables with the polyshape or centroid?
which centroid -all
should return
matlabroot\toolbox\matlab\polyfun\@polyshape\centroid.m % polyshape method
centroid is a built-in method % Shadowed matlab.internal.polygon.builtin.cpolygon method
Respuesta aceptada
Rishabh Mishra
el 4 de Sept. de 2020
Hi,
As stated by Rik , try running the command which centroid -all ,if the compiler does not report the path of ‘centroid()’ function as matlabroot\toolbox\matlab\polyfun\@polyshape\centroid.m % polyshape method then, there is some other function defined in the current workspace that goes by the name ‘centroid’.[PM1]
To find centroids of the whole figure use the code below:
>> c1 = centroid(x1,y1) % centroid of 1sttriangle
>> c2 = centroid(x2,y2) % centroid of 2ndtriangle
>> c = (c1+c2)/2 % centroid of whole figure.
Hope This helps.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Elementary Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!