Creating horizontal regions between functions
2 次查看(过去 30 天)
显示 更早的评论
I tried doing it, but i kept getting it wrong, can you help and tell me what my mistake is.
f = @(x) cos(x);
g = @(x) x-x;
a = 0;
b =1;
fplot(f, [a, pi/2]), hold on
fplot(g, [a, pi/2], 'LineWidth',2)
ycoord = linspace(a, b, 20);
xcoord = [f(ycoord); g(ycoord)];
plot(xcoord, [ycoord;ycoord]), hold off
I used this code^^
but i want this
thanks.
0 个评论
回答(1 个)
Walter Roberson
2022-11-4
Consider the top red line that you want. The x coordinates of the line should start from 0, but should end at the point where cos(x) = 0.95. So for any particular y coordinate, the ending x coordinate should be acos(y)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!