(Automatically) Finding the intersection point of two graphes in my plot

16 visualizzazioni (ultimi 30 giorni)
I have written a script to analyse vectors out of a .txt-file und displays them under certain criteria. The plot I get looks like this.
Now I am trying to find the coordinates of the intersection point between my plot and the right red line.
I don't have functions to describe the lines, only vectors containing the data points. Bot yvectors are plotted over the same xvector. I thought a simple for-loop would suffice but the problem is, that the needed y-value in both y-vectors has a differing location in the vector. So for example if the right value was located in yvector1(100) it would be located in yvalue2(70).
I hope i could somehow explain my problem in an understandable way. Every help is very much appreciated.
The kind of simple loop i tried looks like this:
for cnt=1:numel(xvector)
s1=yvector1(cnt);
s2=yvector2(cnt);
zz=abs(s1-s2);
if zz <= 0.005
fprintf('location at %1.2f kN and %1.2f mm\n\n',yvector1(cnt),xvector(cnt))
end
end

Risposta accettata

KSSV
KSSV il 18 Mag 2016

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by