Highlight Region of Sine Graph
2 次查看(过去 30 天)
显示 更早的评论
I have a sine graph and I want to highlight all along the x-axis and just the [-1,1] region on the y-axis. Is this possible?
This is my code and I would like the bounds between [-1,1] on the y-axis to be shaded some color all along the x-axis. The whole area, not just the peaks and valleys.
0 个评论
采纳的回答
Asad (Mehrzad) Khoddam
2020-10-16
% Do you want this?
x=linspace(0,2*pi,101);
y=sin(x);
area(x,y)
5 个评论
Asad (Mehrzad) Khoddam
2020-10-16
This is the next step:
x=linspace(-5*pi,5*pi,101);
KP1=(6*(sin(x)./(x)))+cos(x);
hold on;
plot(x,KP1)
plot([-5*pi,5*pi],[-1,-1],'r');
plot([-5*pi,5*pi],[1,1],'r');
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!