shade area under curve between 2 x-axis limits
16 次查看(过去 30 天)
显示 更早的评论
For the code below:
x=0:pi/50:2*pi;
y1=x.^2;
baseval1=20;
baseval2=3;
clf;
H1=area(x,y1,baseval1);
H=area(x,y1);
set(H(1),'FaceColor',[1 0.5 0]);
how do I shade the area under the curve just between x = 3 to x = 4?
0 个评论
采纳的回答
Azzi Abdelmalek
2015-7-26
编辑:Azzi Abdelmalek
2015-7-26
x=0:pi/50:2*pi;
y1=x.^2;
H1=area(x,y1);
hold on
idx=x>3&x<4;
H=area(x(idx),y1(idx));
set(H(1),'FaceColor',[1 0.5 0]);
Or
close
x=0:pi/50:2*pi;
y1=x.^2;
%baseval1=20;
%baseval2=3;
%clf;
H1=area(x,y1,'FaceColor',[1 1 1]);
hold on
idx=x>3&x<4;
H=area(x(idx),y1(idx));
set(H(1),'FaceColor',[1 0.5 0]);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!