Hello,
I'd like to know how to plot the following function, defined by the red lines:
I've previously plotted a rectangle, which is easier because I just draw lines between the different points and that's it, but in this one I don't know how to join the extreme points (1, 1) and (5, 1) with the function y = sqrt(x) instead of a straight line.
Thanks.

 採用された回答

madhan ravi
madhan ravi 2018 年 11 月 23 日
編集済み: madhan ravi 2018 年 11 月 23 日

0 投票

x=linspace(0,5,1000);
f= sqrt(x);
x0=5;
y0=interp1(x,f,x0);
plot(x,f,'r')
hold on
plot(0:5,zeros(1,6),'r')
plot(5*ones(1,100),linspace(0,y0),'r')
xlim([-2 6])
ylim([-1 3])
Screen Shot 2018-11-23 at 10.17.07 PM.png

2 件のコメント

Nicolás Ulmete
Nicolás Ulmete 2018 年 11 月 23 日
Thank you!!!
madhan ravi
madhan ravi 2018 年 11 月 23 日
Anytime :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by