how can i contour level control use with 'plot'

조회 수: 2 (최근 30일)
준희 박
준희 박 2021년 12월 2일
댓글: 준희 박 2021년 12월 3일
I want Contour level control in my code
I know how to control the basic contour level,
I don't know contour level control with 'plot' and 'fit' code
how to 'Contour' level control? please teach me (Make the contour spacing more detailed.)
and i want specific number of contour values can be printed out(contour <0 or contour>0)
Please explain it with a picture
x=[1200 1200 1200 1200 1100 1100 1100 1100 1000 1000 1000 1000 900 900 900 900]';
y=[-2 -1 0 1 -2 -1 0 1 -2 -1 0 1 -2 -1 0 1]';
z=[0.577605826 0.488558387 0.45273093 0.478115298 0.547461689 0.460354119 0.420345944 0.43529964 0.497821842 0.370804822 0.305371971 0.318197107 0.416543949 0.372316357 0.339559983 0.319807786]';
f = fit( [x, y], z, 'cubicinterp' )
Piecewise cubic interpolant: f(x,y) = piecewise cubic surface computed from p Coefficients: p = coefficient structure
ph = plot(f, 'Style', 'Contour');
set(ph, 'Fill', 'off', 'LineColor', 'auto');
grid off;
C = get(ph, 'ContourMatrix');
clabel(C, ph);

채택된 답변

DGM
DGM 2021년 12월 3일
편집: DGM 2021년 12월 3일
You can set the LevelList property
x=[1200 1200 1200 1200 1100 1100 1100 1100 1000 1000 1000 1000 900 900 900 900]';
y=[-2 -1 0 1 -2 -1 0 1 -2 -1 0 1 -2 -1 0 1]';
z=[0.577605826 0.488558387 0.45273093 0.478115298 0.547461689 0.460354119 0.420345944 0.43529964 0.497821842 0.370804822 0.305371971 0.318197107 0.416543949 0.372316357 0.339559983 0.319807786]';
f = fit( [x, y], z, 'cubicinterp' );
ph = plot(f, 'Style', 'Contour');
set(ph, 'Fill', 'off', 'LineColor', 'auto');
ph.LevelList = linspace(0.2,0.6,20); % just pick some levels
grid off;
C = get(ph, 'ContourMatrix');
clabel(C, ph);

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by