필터 지우기
필터 지우기

How can I show the maximum in my graphs?

조회 수: 2 (최근 30일)
Mo_B
Mo_B 2017년 1월 10일
댓글: the cyclist 2017년 1월 11일
Hi guys,
I got the maximum of y4, but I don't know how to show it in my graphs.
clear all
close all
x=(0:0.01:80).';
y1=(0.02049/0.4)*x;
y2=(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
y3=(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)))-(0.02049/0.4)*x;
y4=(0.02049/0.4)*x-(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
figure
plot(x,y1,'r')
hold on
plot(x,y2,'c')
plot(x,y3,'g')
plot(x,y4,'b')
legend('Line1','Line2','Line3','Line4')
axis([0 80 -1 3.5])
x=linspace(0, 80, 200);
y4=@(x) (0.02049/0.4)*x-(0.53*60./(1+(1.331./(sqrt(0.0631*x./(83.18-x))).^3)));
f = y4(x);
[y4Max, iMax] = max(f)
xMax = x(iMax)
Thank you very much

채택된 답변

the cyclist
the cyclist 2017년 1월 10일
Do you mean like this?
line([xMax xMax],ylim)
  댓글 수: 2
Mo_B
Mo_B 2017년 1월 10일
편집: Mo_B 2017년 1월 10일
Thanks a lot, do you know a way to stop the vertical line when it hits the function? And display the x-value?
the cyclist
the cyclist 2017년 1월 11일
y_lim = ylim;
line([xMax xMax],[y_lim(1) y4Max])
text(xMax,y4Max+0.1,'Wheeee!')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by