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

3 次查看(过去 30 天)
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)

采纳的回答

MathWorks Support Team
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".

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

产品


版本

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by