Find "intersection" of data array
显示 更早的评论
Hello everybody,
I would like to find the "intersections" of different data arrays. The arrays look similar this:
x=[0 1.2 2.5 3.4 4.6 5.4 6.8 7.3 8.6 9.8 7.1 8.5 9.9 10.1 11.4]
y=[100 90 80 70 65 60 55 50 45 40 40 42 44 52 62]
I would like to cut off the part under the intersection and redefine the data set. So it would be enough to find the two connection points (in this example (8.6;45) and (9.9;44)). Any ideas, how to do this? I have ran out of ideas and really need new ideas/inspiration from you guys!
Cheers, Christian
6 个评论
Image Analyst
2018-9-3
Not sure what you mean. I don't see how there is any intersection going on at 8.6 and 9.9.
x=[0 1.2 2.5 3.4 4.6 5.4 6.8 7.3 8.6 9.8 7.1 8.5 9.9 10.1 11.4]
y=[100 90 80 70 65 60 55 50 45 40 40 42 44 52 62]
plot(x, y, 'bo-', 'LineWidth', 3)
grid on;
xticks(0:0.5:12)
hold on;
for k = 1 : length(x)
str = sprintf(' %d', k);
text(x(k), y(k), str, 'FontSize', 25, 'FontWeight', 'bold', 'Color', 'r');
end
xlabel('X', 'FontSize', 25);
ylabel('Y', 'FontSize', 25);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);

What does "cut off the part under the intersection" really mean? In the plot above, which points do you want to delete or do something else with???
Christian
2018-9-3
Selby
2018-9-3
you could possibly write a script that removes any points with a lesser x value than the last. However that would mean that you would have 9->10->13
Christian
2018-9-4
Walter Roberson
2018-9-4
What would be the expected result for a case such as
9
13
10
11 12
where the data "doubles back" but does not intersect itself?
Christian
2018-9-4
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!