Prev: Please help
Next: Calculating the age of a person
From: W. eWatson on 13 Feb 2010 21:34 See Subject. I seldom use ML, but I'm told it can be done. My real app is for Python Matplotlib. There's likely a corresponding way there, hopefully with the same name.
From: Walter Roberson on 13 Feb 2010 23:33 W. eWatson wrote: > See Subject. I seldom use ML, but I'm told it can be done. My real app > is for Python Matplotlib. There's likely a corresponding way there, > hopefully with the same name. You will have to calculate where the intersection of the lines is, and then use plot() to draw a marker there. There is no automatic facility in Matlab to put markers at the intersection of lines. Calculating where the intersection of the lines *is* might be simple or it might be computationally infeasible (for example, calculating the exact location of the intersection of two chaotic curves might take exceedingly long.)
From: Rune Allnor on 14 Feb 2010 02:35 On 14 Feb, 05:33, Walter Roberson <rober...(a)hushmail.com> wrote: > Calculating where the intersection of the lines *is* might be simple or > it might be computationally infeasible (for example, calculating the > exact location of the intersection of two chaotic curves might take > exceedingly long.) If the curves are represented as a set of ponts that are joined by linear segments, there exist algorithms that report the intersections in time proportional with the number of line segments and the number of intersections. This can be very much faster than brute-force searches, if only a few intersections exist. If, however, every segment intersects all other segments, then the worst-case performance is O(n^2) where n is the number of line segments. Just be aware that these algorithms rely heavily on dynamic search tree data structures, so I wouldn't implement this in matlab. Rune
From: Bruno Luong on 14 Feb 2010 04:09 "W. eWatson" <wolftracks(a)invalid.com> wrote in message <hl7nfh$eei$1(a)news.eternal-september.org>... > See Subject. I seldom use ML, but I'm told it can be done. My real app > is for Python Matplotlib. There's likely a corresponding way there, > hopefully with the same name. This might be what you need: http://www.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections Bruno
From: W. eWatson on 14 Feb 2010 11:44
On 2/13/2010 11:35 PM, Rune Allnor wrote: > On 14 Feb, 05:33, Walter Roberson<rober...(a)hushmail.com> wrote: > >> Calculating where the intersection of the lines *is* might be simple or >> it might be computationally infeasible (for example, calculating the >> exact location of the intersection of two chaotic curves might take >> exceedingly long.) > > If the curves are represented as a set of ponts that are joined > by linear segments, there exist algorithms that report the > intersections in time proportional with the number of line segments > and the number of intersections. This can be very much faster > than brute-force searches, if only a few intersections exist. > > If, however, every segment intersects all other segments, then the > worst-case performance is O(n^2) where n is the number of line > segments. > > Just be aware that these algorithms rely heavily on dynamic search > tree data structures, so I wouldn't implement this in matlab. > > Rune > > Perhaps join would have been a better word. When I use plot in MPL, the lines are like straight path segments that are connected. It seems to me this should be easy. I have all the x,y pairs. Here's a simple example. Start at (0,0). Next are (1,1.5) and (2.2). Plot draws 2 straight line segments. I want the marker at (1,1.5). Say a yellow circle. plot(1,1.5,"yo")? In Pyton MPL, it may be almost the same, but one usually needs some qualifier like pyplot.plot(1,1.5, "yo") I have yet to find the right combo. |