get the correct data of intersection in plot

11 visualizzazioni (ultimi 30 giorni)
Hi, I'm working on a project in which i want to know the time on which the accuracy lines hit 95% for the first time. I've already looked in some related topics but didn't find any that could help me on it.
Although the figure below contains two sets of lines only the accuracy ones are of importance.
below a simplified representation of the code for this graph.
frequencies = [7.5 15 30 60 120 240];
nfrequencies = numel(frequencies);
duration = 0.2:0.2:8.5;
for a=1:nfrequencies
accuracy(:,a)=(a+2)*(a+2.5)*duration+10;
ltext{a}=[num2str(frequencies(a)), 'Hz'];
end
plot(duration,accuracy)
axis([0.2 8.5 0 102])
legend(ltext,'Location','southeast');

Risposta accettata

Jacco vD
Jacco vD il 15 Ago 2016
none of those seem to work this case.
So I fixed it simply like this. It gives me the first time that the accuracy of a given frequency is 95%, which is what in need;)
duration = 0.2:0.2:8
nfrequencies = 6
threshold = accuracy*100>=95;
X = zeros(nfrequencies,1)
for l=1:nfrequencies
fthreshold = find(threshold(:,l));
if fthreshold >= 1
Y = duration(fthreshold(1));
else
Y = max(duration);
end
X(:,l)= Y;
end

Più risposte (1)

Thorsten
Thorsten il 5 Ago 2016
You can compute the first intersection of each curve with a horizontal line of height 95. There are various ways to compute intersections, as described in http://blogs.mathworks.com/pick/2011/09/09/detect-curve-intersections-quickly-and-easily/?s_tid=srchtitle

Categorie

Scopri di più su Discrete Data Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by