Hello, I have been trying to understand what the contour levels are.
Matlab docs state that the contourc function takes an argument that determines the levels of which the contours are computed upon, and I have been playing around with the parameter in hope of recognising what they really represent but I honestly cannot get a grip on that.
I will be so grateful if someone could clue me in.
Thank you all,

답변 (1개)

John D'Errico
John D'Errico 2018년 10월 11일

0 개 추천

A contour of the function z(x,y) is a set of points in the (x,y) plane, such that z(x,y) is fixed at some constant value. That constant value is the contour "level". That set of points in the (x,y) plane is often called a level set.
contour (as well as contourc) allow you to supply specific levels if you are interested in some specific value for z, or you can just tell it a number n (an integer). In that case, contour generates n levels between the min and max of the function over the domain of interest.

댓글 수: 2

Nour Eddin Ramadan
Nour Eddin Ramadan 2018년 10월 12일
Thank you, that was helpful.
Nour Eddin Ramadan
Nour Eddin Ramadan 2018년 10월 12일
편집: Nour Eddin Ramadan 2018년 10월 12일
I wanted to try that out, so I constructed a picture with 10 rectangles, each of which has a distinct depth starting from 0.1 ending up at 1.0, and I ran the contour function to see the highlighted contours according to the specified levels in the input, but the results weren't expected.
For instance, I ran the code on 0.1 contour level and the contour function produces all the contours in the picture, not only the ones with 0.1 level.
Code:
pic = zeros(500, 500);
val = 0.1;
shift = 40;
for j = 1:10
for i= 50:450
pic(shift*j,i) = val;
end
for i= 50:450
pic(shift*j+25,i) = val;
end
for i = shift*j: shift*j+25
pic(i, 50) = val;
pic(i,450) = val;
end
val = val + 0.1;
end
imshow(pic);
figure(2);
contour(pic, [0.1 0.1]);
Did I not get what you meant or am I doing something wrong here?
Thanks in advance,

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

카테고리

도움말 센터File Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2018년 10월 11일

편집:

2018년 10월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by