필터 지우기
필터 지우기

How does the matlab contourf function work?

조회 수: 2 (최근 30일)
Jenna
Jenna 2020년 3월 17일
답변: darova 2020년 3월 17일
How does the matlab contourf function work? The function describes, "MATLAB® automatically selects the contour lines to display." -- but how does Matlab automatically select the lines? (Histogram? some other statistic?)
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 3월 17일
The documentation does not specify how MATLAB calculates the contour lines internally. Also, you cannot see the internal implementation of the function, which draws the contour. However, you can specify the levels input of the contour function to set the value of contour lines manually.
Jenna
Jenna 2020년 3월 17일
Yes. I know. I'm wondering if someone who works at matlab can describe the functionality a bit for me. Thanks

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

답변 (1개)

darova
darova 2020년 3월 17일
I pretty sure that MATLAB checks each 'plane' (that close to some level) on intersection
Simply reducing the task to plane-plane intersection
clc,clear
cla
[X,Y] = meshgrid(-2:0.1:2);
Z = X.^2+Y.^2-3;
p = surf2patch(X,Y,Z);
surf(X,Y,Z,'edgeColor','none')
alpha(0.5)
f = p.faces;
v = p.vertices;
axis vis3d
for i = 1:size(f,1)
ix = f(i,:);
sgn = sign(v(ix,3));
if abs(sum(sgn)) < 4 % if 'z' values have different sign
patch('faces',ix,...
'vertices',v,...
'faceColor','none')
pause(0.1)
end
end

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by