\graphing witth multiple functions

조회 수: 3 (최근 30일)
Meghan Griffin
Meghan Griffin 2019년 10월 2일
편집: Meghan Griffin 2019년 10월 6일
fff

채택된 답변

Shubham Gupta
Shubham Gupta 2019년 10월 2일
편집: Shubham Gupta 2019년 10월 2일
Try :
a = gca;
hold on
plot(a.XLim,[560, 560],'m--') % plots horizontal line at y = 560
To find the intersection point at y = 560 with the function data ('ydata' for example below)
indx = find((ydata-560).*([ydata(1),ydata(1:end-1)]-560)<0); % finds index corresponding to intersection points
num_of_intersection = length(indx)
xintersect = xdata(indx)
Let me know if there is any doubt
  댓글 수: 1
Shubham Gupta
Shubham Gupta 2019년 10월 3일
편집: Shubham Gupta 2019년 10월 3일
I am sorry, I forgot to mention that I assumed ydata to be a row vector. So, can you please try to define ydata as a row vector before finding indeces for the intersection? Use:
ydata = Plength(:,3)';

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

추가 답변 (0개)

카테고리

Help CenterFile 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