Difference between convhull() and convhulln()?

조회 수: 14 (최근 30일)
david dang
david dang 2015년 7월 11일
답변: Witek Jachimczyk 2025년 12월 9일 3:48
In MATLAB's function libraries, there are 2 functions that achieve descriptively the same purpose: 1) convhull() 2) convhulln()
I notice that these 2, when applied to the same set of input, gives me slightly different answers for volume (negligible error, but I am confused why there is a difference since I thought the algorithm gives an EXACT volume). And for some sets of vertices, convhulln() outputs an error while convhull() works.
Can someone explain to me the difference between the two?

답변 (4개)

Walter Roberson
Walter Roberson 2015년 7월 11일
convhulln can operate in higher dimensional spaces.
Negligible error would be due to floating point roundoff, probably.

Image Analyst
Image Analyst 2015년 7월 11일
convhull() operates on 2D data - points in an infinitely thin plane. How are you computing the volume from that? It won't have a volume. Or a volume of zero.
convhulln operates on higher dimensional data. In 3D it would be like putting a tight balloon around your points. It would return the points that are "pointy" in your balloon envelope. How do you compute the volume from that?
  댓글 수: 1
david dang
david dang 2015년 7월 12일
I've been computing the volume with convhull() just fine http://www.mathworks.com/help/matlab/ref/convhull.html It has a volume output. It works in 3-D

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


John D'Errico
John D'Errico 2015년 7월 12일
Welcome to the wonderful, wacky world of floating point arithmetic.
There is no such thing as an "exact" computation when done in floating point arithmetic by two distinct code sequences. That you get subtly (though negligibly) different results when two different computations are applied is no surprise at all. Many such mathematically, theoretically identical operations, when implemented in floating point arithmetic, will fail to yield numerically identical results.

Witek Jachimczyk
Witek Jachimczyk 2025년 12월 9일 3:48
Pls. have a look at this page:
This is the relevant passage:
"MATLAB provides the convhulln function to support the computation of convex hulls and hypervolumes in higher dimensions. Though convhulln supports N-D, problems in more than 10 dimensions present challenges due to the rapidly growing memory requirements.
The convhull function is superior to convhulln in 2-D and 3-D as it is more robust and gives better performance."
HTH,
Witek

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by