File Exchange

image thumbnail

Line Intersect

version 1.0.0.0 (919 Bytes) by Jonathan Millin
Finds the points of intersection for linear time series data, very efficiently

1 Download

Updated 21 Apr 2008

No License

Finds the intersection point for a set of time series data, without any loops.

Elapsed time is 0.000212 seconds, searching 1800 points, and finding 90 intersections, on a Core 2 Duo E6600 :)

Example Code::
~~~~~~~~~~~~~~

numElem= 50;
a=rand(numElem,1);
b=rand(numElem,1);
xs=1:numElem;

[x,y, signs]=lineIntersect(a,b);
plot(xs,a,'k',xs,b,'b',x,y,'ro')

Cite As

Jonathan Millin (2020). Line Intersect (https://www.mathworks.com/matlabcentral/fileexchange/19642-line-intersect), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

w s

There is a similar file on the FEX
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=6679&objectType=file

In how far does your file differ from this one?

Jos x@y.z

It errors and produces wrong results for certain inputs. I hope you can either fix this or check for such (quite normal) inputs.

>> Lineintersect([0 1 2 4],[2 1 2 3 ])
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.

>> Lineintersect([0 1 2 4].',[2 1 2 3 ].')
Warning: Divide by zero.
> In lineIntersect at 44
ans = NaN

I will not rate this for now (2-star), because I think the authors can solve this. While they are at it, I hope they also modify the help section considerably, including a H1 line, adding detailed description of input and output parameters.

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux