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에서 Line Plots에 대해 자세히 알아보기

질문:

2018년 11월 23일

댓글:

2018년 11월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by