Question about convhull code

1 visualización (últimos 30 días)
Ingo Rück
Ingo Rück el 19 de Jul. de 2017
Editada: Jan el 19 de Jul. de 2017
Hello everyone,
I'm using the function convhull to create a better looking hill chart. For that purpose I need to know how Matlab determines at which point the hull-curve should start. The documentation of convhull doesnt tell me anything and I'm too unexperienced to dig into the code of the function itself (that and I dont know when something is considered "reverse engineering", which might be illegal anyway).
  2 comentarios
Image Analyst
Image Analyst el 19 de Jul. de 2017
Please include some screen shots. You can edit any program and see what it does, at least to some extent, for example
>> edit convhull.m
Perhaps you'd be interested in the boundary() or envelope() function instead - not sure until we see your data.
Jan
Jan el 19 de Jul. de 2017
Editada: Jan el 19 de Jul. de 2017
@Ingo: You have mentioned in your other thread, that you need the hull start with the smallest X and Y position. By the way: Whenever you post multiple thread about one problem, add a link to the thread in the other forum also. Otherwise such "cross-posting" can waste the time of the ones, who write an already given answer. Thanks.

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 19 de Jul. de 2017
Editada: Jan el 19 de Jul. de 2017
Reading the M- and C-files is considered to be legal.
You can resort the output easily to be sure that it has the wanted order:
K = convhull(X,Y);
C = [X(K), Y(K)];
[~, Index] = sortrows(C); % Only the first entry matters
if Index(1) ~= 1 % Reordering required
K = circshift(K, -Index(1) + 1);
end
Now the first index in K is the position with the smallest X and Y values.
In the current Matlab version, K is ordered as you want it. But you cannot be sure if this is the general case, such that the above check is safer.

Más respuestas (0)

Categorías

Más información sobre Bar Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by