fill comand (functions)

조회 수: 2 (최근 30일)
felix jose chavez torres
felix jose chavez torres 2017년 9월 4일
답변: Star Strider 2017년 9월 4일
how can i fill just this area in matlab? i need help.
  댓글 수: 1
KSSV
KSSV 2017년 9월 4일
provide the code which you have plotted this...

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

채택된 답변

Star Strider
Star Strider 2017년 9월 4일
Try this:
x = linspace(-5, 5); % Define Indepenent Variable
upgoing_curve = x.^2; % Define First Curve
downgoing_curve = 5 - x.^2; % Define Second Curve
idx = (downgoing_curve > upgoing_curve) & (x >= 0); % Define Region-Of-Interest
figure(1)
plot(x, upgoing_curve, x, downgoing_curve, '-k');
hold on
patch([x(idx) fliplr(x(idx))], [upgoing_curve(idx) fliplr(downgoing_curve(idx))], 'g')
hold off
The patch call defines the independent variable and then flips it, and the dependent variables and flips the second one. The idea here is to create a closed curve, defined by ‘x(idx)’ and its ‘mirror image’, and the lower curve and the flipped version of the upper curve.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by