필터 지우기
필터 지우기

color area between functions

조회 수: 2 (최근 30일)
Nora Al Allaf
Nora Al Allaf 2020년 10월 28일
댓글: Akira Agata 2020년 10월 28일
Hi,
I have two functions g = exp(-x.^2./2) and h = x.^2-3.*x+2;
there is a region enclosed between them, between x=0 and x=3
I wanna color it using fill
how to? =)

채택된 답변

David Hill
David Hill 2020년 10월 28일
x = -1:.01:4;
g = exp(-x.^2./2);
h = x.^2-3.*x+2;
plot(x, g, 'r', 'LineWidth', 2);
hold on;
plot(x, h, 'b', 'LineWidth', 2);
x=.43:.01:2.08;
x2 = [x, fliplr(x)];
g = exp(-x.^2./2);
h = x.^2-3.*x+2;
inBetween = [g, fliplr(h)];
fill(x2, inBetween, 'g');

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by