get the correct data of intersection in plot

조회 수: 14 (최근 30일)
Jacco vD
Jacco vD 2016년 8월 5일
답변: Jacco vD 2016년 8월 15일
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');

채택된 답변

Jacco vD
Jacco vD 2016년 8월 15일
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

추가 답변 (1개)

Thorsten
Thorsten 2016년 8월 5일
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

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by