Number of line for fcontour
조회 수: 4 (최근 30일)
이전 댓글 표시
If somebody can tell me how to increase number of lines for fcontour plot I would be much grateful. Thanks in advance.
댓글 수: 0
채택된 답변
Star Strider
2021년 11월 27일
A somewhat different approach —
syms x y
z(x,y) = exp(-(x-5)^2) + cos(y)
figure
hfc = fcontour(z, [0 10 -2*pi 2*pi]);
colormap(turbo)
title('Default Levels')
figure
hfc = fcontour(z, [0 10 -2*pi 2*pi]);
Lvls = hfc.LevelList;
hfc.LevelList = linspace(min(Lvls), max(Lvls), 5*numel(Lvls));
colormap(turbo)
title('Increased Countours, Same Range')
.
댓글 수: 0
추가 답변 (1개)
Image Analyst
2021년 11월 26일
Look at the max and min of your surface, then compute the 'LevelStep' using the number of contours you want. Something like (untested)
numContours = 10;
levelStep = (max(z(:)) - min(z(:))) / numContours;
fcontour(z, 'LevelStep', levelStep);
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


