get the correct data of intersection in plot

11 ビュー (過去 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 Center および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by