2
$\begingroup$

I have a set of data (less than 6kB) that has a breaking point when plotted (for example, using ListPlot).

testbreak = ToExpression /@ Import["~\\test_break_curve.csv"];
plt = ListPlot[testbreak, PlotRange -> {{0, 4}, All}, Frame -> True]

enter image description here

I want to find the coordinates of the breaking point(s) so that I can plot it with ListLinePlot as two segments of continuous curves (in solid lines) instead of points. In other words, I don't want the part in the black box but need the coordinates of the two points in the circles. The following figure is plotted with ListLinePlot. Is there a method to do this? Thank you in advance!

enter image description here

$\endgroup$

3 Answers 3

3
$\begingroup$

Choice of transition step as 0.1 is arbitrary.

blist = testbreak[[All, 2]] // Differences;
pos = Position[blist, _?(Abs@# > 0.1 &)]

{{122}}

Coordinates for the transition

excl = testbreak[[{122, 123}]]

{{2.425, -0.584512}, {2.445, -1.09194}}

TakeDrop[testbreak, Det@pos] //
 ListLinePlot[#
   , PlotStyle -> Thick
   , Epilog -> {Dashed, Red, Line@excl}
   ] &

enter image description here

$\endgroup$
4
$\begingroup$

We split the points of sequence by the Max difference quotient.

index=Ordering[
 Abs[(Last[#2] - Last[#1])/(First[#2] - First[#1])] & @@@ 
  Partition[testbreak, 2, 1], -1]//First

122

pts = TakeList[testbreak, {index - 1, 2, All}];
pts[[2]]
ListPlot[pts, PlotStyle -> {Blue, Dashed, Green}, Joined -> True]

enter image description here

$\endgroup$
4
$\begingroup$

Using Split:

ListLinePlot[
 Split[
  testbreak,
  Abs[#[[2]] - #2[[2]]] < 0.1 &
  ]
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.