\graphing witth multiple functions

2 Ansichten (letzte 30 Tage)
Meghan Griffin
Meghan Griffin am 2 Okt. 2019
Bearbeitet: Meghan Griffin am 6 Okt. 2019
fff

Akzeptierte Antwort

Shubham Gupta
Shubham Gupta am 2 Okt. 2019
Bearbeitet: Shubham Gupta am 2 Okt. 2019
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 Kommentar
Shubham Gupta
Shubham Gupta am 3 Okt. 2019
Bearbeitet: Shubham Gupta am 3 Okt. 2019
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)';

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by