Making a horizontal region between two functions

2 ビュー (過去 30 日間)
Ibraheem
Ibraheem 2022 年 11 月 4 日
編集済み: Torsten 2022 年 11 月 5 日
How do i fix this, my region is showing on the wrong part of the fuction, but i want it on the other part. can i get help
f = @(x) x.^3;
ivf = @(y) y.^(1/3);
g = @(x)x-x;
ivg = @(y) y-y;
a = 0;
b =1;
fplot(f, [a, b]), hold on
fplot(g, [a, b], 'LineWidth',2)
ycoord = linspace(a, b, 20);
xcoord = [ivf(ycoord); ivg(ycoord)];
plot(xcoord, [ycoord;ycoord]), hold off
thanks

回答 (1 件)

Torsten
Torsten 2022 年 11 月 4 日
編集済み: Torsten 2022 年 11 月 5 日
f = @(x) x.^3;
g = @(x) x.^(1/3);
a = 0;
b = 1;
hold on
fplot(f,[a,b])
n = 20;
for i = 1:n+1
start = [g((i-1)/n*b),1];
ende = [(i-1)/n*b,(i-1)/n*b];
plot(start,ende,'r')
end
hold off
grid on

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by