I have data for heading (varies between 0 and 360 degrees) and I want to find every point that the heading crosses 240 degrees. Attached is a picture of the heading vs time. Since we are moving in circles the pattern is repeatable. I want to find each point the heading crosses 240 degrees, but I don't want the points where the heading resets from 0 to 360 degrees denoted by the vertical line in the plot.
This is what I have in my code, but its not finding anything
find(diff(hdg) < 25 & hdg(1:end-1) < 240 & hdg(2:end) > 240)
if I remove the
condition I get results but its finding the indices where the heading resets from 0 to 360 degrees (vertical line), I don't want to include those points, just where the heading actually crosses 240 degrees. Also note that the hdg data is not continuous, it looks similar to this
hdg = [0, 3.2556, 6.3458, 9.2654, 12.66, 16.225, ...