Why do CONTOUR and CONTOURC produce different results in MATLAB 7.8 (R2009a)?

7 Ansichten (letzte 30 Tage)
The CONTOURC documentation states that: "contourc calculates the contour matrix C used by contour, contour3, and contourf.". So I am wondering why the following code does not produce the same results for C1 and C2:
[C1,h] = contour(peaks)
C2 = contourc(peaks)

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 27 Jun. 2009
When using CONTOUR and CONTOURC the results C1 and C2 might indeed differ:
[C1,h] = contour(peaks)
C2 = contour(peaks)
However C1 and C2 are not necessarily expected to be exactly the same. As of MATLAB 7.4 (R2009a) the CONTOUR documentation provides the following explanation:
[C,h] = contour(...) returns a contour matrix, C, derived from the matrix returned by the low-level contourc function, and a handle, h, to a contourgroup object. clabel uses the contour matrix C to create the labels. (See descriptions of contourgroup properties.)
In this context "derived" indicates the matrices are not exactly the same, which is due to numerical precision as well as post-processing that occurs in CONTOUR. The same holds true for the sentence: "contourc calculates the contour matrix C used by contour".

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by