DSPRelated.com
Forums

How to detect turning points in curves

Started by Linus Utopia July 12, 2007
How to detect turning points in curves

Hi all,

If you take a look at the following plot,

http://img63.imageshack.us/img63/5050/gggyt1.jpg

You will agree with me that there are two turning points.

But is there a systematic way to let computer detect the turning points
automatically and programmatically?

Please be advised that the second turn isn't neccessarily turning down, it
can also possibly go up...

And in real-world applications, the turn can be more smooth and round, but
still, naked eyes should be able to find the turning points easily.

My program has to do a classification:

All the good curves should first go down, and then either make no turns; or
make a turn, and stay vertically flat and slightly up, going from the left
to the right.

There should be no second turn (up or down). If there is the second turn,
then that's the bad curves.

My program needs to decern the good curves from bad curves.

I cranked a few algorithms but they don't work well. Are there systematic
methods of handling this?

Please be advised that my curves are not continuous -- they are discrete 
data points. When I plotted them in Matlab, they are connected and looked 
like a continous curve. So I am not sure if the second "finite difference" 
will help..., and accurately...

Thanks a lot!



On Jul 12, 5:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote:
> How to detect turning points in curves > > Hi all, > > If you take a look at the following plot, > > http://img63.imageshack.us/img63/5050/gggyt1.jpg > > You will agree with me that there are two turning points. > > But is there a systematic way to let computer detect the turning points > automatically and programmatically?
What condition always holds at a turning point? [...]
"Eric Gisse" <jowr.pi@gmail.com> wrote in message 
news:1184292390.619167.157010@x35g2000prf.googlegroups.com...
> On Jul 12, 5:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: >> How to detect turning points in curves >> >> Hi all, >> >> If you take a look at the following plot, >> >> http://img63.imageshack.us/img63/5050/gggyt1.jpg >> >> You will agree with me that there are two turning points. >> >> But is there a systematic way to let computer detect the turning points >> automatically and programmatically? > > What condition always holds at a turning point? > > [...] >
Please don't say the "1st derivative=0"... This is about numerical discrete data analysis, not the theoretical world...
Linus Utopia wrote:
> "Eric Gisse" <jowr.pi@gmail.com> wrote in message > news:1184292390.619167.157010@x35g2000prf.googlegroups.com... > >>On Jul 12, 5:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: >> >>>How to detect turning points in curves >>> >>>Hi all, >>> >>>If you take a look at the following plot, >>> >>>http://img63.imageshack.us/img63/5050/gggyt1.jpg >>> >>>You will agree with me that there are two turning points. >>> >>>But is there a systematic way to let computer detect the turning points >>>automatically and programmatically? >> >>What condition always holds at a turning point? >> >>[...] >> > > > Please don't say the "1st derivative=0"... > > This is about numerical discrete data analysis, not the theoretical world... > > >
Think about signs of first thru n'th derivative.
Linus Utopia wrote:
> "Eric Gisse" <jowr.pi@gmail.com> wrote in message > news:1184292390.619167.157010@x35g2000prf.googlegroups.com... >> On Jul 12, 5:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: >>> How to detect turning points in curves >>> >>> Hi all, >>> >>> If you take a look at the following plot, >>> >>> http://img63.imageshack.us/img63/5050/gggyt1.jpg >>> >>> You will agree with me that there are two turning points. >>> >>> But is there a systematic way to let computer detect the turning points >>> automatically and programmatically? >> What condition always holds at a turning point? >> >> [...] >> > > Please don't say the "1st derivative=0"... > > This is about numerical discrete data analysis, not the theoretical world...
How about a more-or-less abrupt change in the average first difference? You're only dead in the water when you stop thinking. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
In sci.physics Linus Utopia <linus_utopia@gmail.com> wrote:
> How to detect turning points in curves
> Hi all,
> If you take a look at the following plot,
> http://img63.imageshack.us/img63/5050/gggyt1.jpg
> You will agree with me that there are two turning points.
> But is there a systematic way to let computer detect the turning points > automatically and programmatically?
> Please be advised that the second turn isn't neccessarily turning down, it > can also possibly go up...
> And in real-world applications, the turn can be more smooth and round, but > still, naked eyes should be able to find the turning points easily.
> My program has to do a classification:
> All the good curves should first go down, and then either make no turns; or > make a turn, and stay vertically flat and slightly up, going from the left > to the right.
> There should be no second turn (up or down). If there is the second turn, > then that's the bad curves.
> My program needs to decern the good curves from bad curves.
> I cranked a few algorithms but they don't work well. Are there systematic > methods of handling this?
> Please be advised that my curves are not continuous -- they are discrete > data points. When I plotted them in Matlab, they are connected and looked > like a continous curve. So I am not sure if the second "finite difference" > will help..., and accurately...
> Thanks a lot!
Well, if all the curves look like that... Start at the middle X value. Calculate the slope around that value. The number of points to use will likely be an empirical determination from trial and error based on the noise in the data. From the curve presented, the slope should be a small number and only a few points needed. Work out to the ends. When the slope begins to change past some empirically defined limit, you've found the start of a change. From the curve presented, the slope at the ends should be a big number. If you get big numbers for the large and small X values, you have turning points. You can do other things like find the slope starting at the ends and work across X until the slope gets small. Break the data into segments of constant slope within some limit. From those segements, determine where a straight line fit to the segments intersect giving you the turning point. Good data will have two segments, bad three. Depends on how much you want to analyze it. -- Jim Pennino Remove .spam.sux to reply.
On Jul 12, 10:50 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote:
> "Eric Gisse" <jowr...@gmail.com> wrote in message > > news:1184292390.619167.157010@x35g2000prf.googlegroups.com... > > > > > > > On Jul 12, 5:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: > >> How to detect turning points in curves > > >> Hi all, > > >> If you take a look at the following plot, > > >>http://img63.imageshack.us/img63/5050/gggyt1.jpg > > >> You will agree with me that there are two turning points. > > >> But is there a systematic way to let computer detect the turning points > >> automatically and programmatically? > > > What condition always holds at a turning point? > > > [...] > > Please don't say the "1st derivative=0"... > > This is about numerical discrete data analysis, not the theoretical world...- Hide quoted text - > > - Show quoted text -
In other words Linus, you either slept through calculus and partial differential equations, or the concept of a "point of inflection" was beyond your grasp. You also seem to confuse what you call "discrete data analysis" with calculus and partial differential equations, which indeed form the basis of the mathematical abstratction that lead us to "theoretical physics". My friend, listen to what Eric says to you, because if you falsely believe that the derivative is a product of "discrete data analysis", then you need to back and review the concepts taught in chapters 1 and 2 of your Calculus 101 course. Dust off your old copies of "Taylor" or "Thomas", or a current text in vogue, and re-read the introductory chapters, since you evidently missed them the first time around. Until you've learned them, you cannot possibly grasp the concepts of integral calculus, or how calculus is applied in a 3-dimensional world! Not to be sarcastic, but you really need to learn to crawl before you try to run! :-) If you can't read the language, it's very difficult to discern the plot of the book! Now it can get confusing to beginners where the point of inflection, the turning point is, of a curve in 3-dimensions, because you must simultaniously consider dx/dt, dy/dt, and dz/dt simultaneously, and they may not all equal "0" at the same moment. Usually they don't. It's sometimes hard to visualize. Unfortunately, that's the situation in 3-dimensional space. Then to farther complicate the issue, it makes a great deal of difference what reference frame that you chose to employ, and sometimes that becomes a mathematically abstraction, such as using a Hamiltonian, or other transform frame. The concept here is that you use a referernce or transform frame that makes the soluton of the differential equation solvable within that frame, then you map or back-transform that solution to an x,y,z reference frame, or any other that you can mentally visualize. The trick is finding a reference frame of transform that renders the resulting differential equation solvable. The following steps involve only turning a crank. EE's tend to prefer Laplace tranforms, physicists seem to prefer Hamiltonians and others. There are actually quite a few. My knowledge of theoretical analysis is becoming rather dated since it is circa 1970, so Eric is a far better current source. Still, my methods help to place man on the moon, and allow vehicles from earth to orbit distant planets, so their is something to be said for it. Just think about this: How many points of infelction encounted on the flight of a space probe launched from earth with a goal of orbiting one of Mar's moons? That is, how many times does the trajectory change slope, direction, and velocity? That's why you will never learn anything about physics from coffee table books sold to the public at places like "Barnes & Noble". On a more positive closing note, even a bricklayer or accountant has access to real information today. Here's a secret that I will share with you that I have with some of my close friends, including one very bright guy and an excellent craftsman, who make his living as a professional tile guy. Hopefully, Eric will agree with me on this --> First click on the website of any noted science or techological university, say Cal Tech or MIT, or whatever. Most of these websites will provide descriptions of all of their courses, what their goal is, and the text utilized in the course. You write the name of the text down, and go to a bookseller like Amazon.com and search for that book. Typically Amazon will first offer you a brand new copy of the text, but you don't need that because likely only the problem sets have changed from past editions (basic physics doen't change frequently). They will then provide you with a list of "used" copies available, which are often 50% or more less expensive than the current edition. Buy one of these. Read each chapter at least 3-times, and then work all of the problem sets. This may on something like calculus or differential equations, 6- months to a year, working the problems at least 3 entire evening each week. (It like going to college, except for the partys and the expense.) When you complete the equivalent of one course, and if you run into dead-end questions, ask one of the more trusted and reliable posters here for help by email (email because it avoids reponses by the crackpots who now seem to dominate the posts on sci.physics). Next, move on to the next subject (based on the curiculum of the college that you are trying to tuition-free track.) Figure about 3-5 years of study to gain a BS level education in math or physics, but other than the cost of the textbooks, it will not have cost you a dime. Remember that tile guy that I mentioned? He is still laying tile for his day living (which he is extremely good at, to minimize). He now uses his computer to do visualizatons of protraits, and convert them to fine mosaic tile bathroom floors at about $60,000 each. He also no earns a consulting income from multiple local technical schools teaching physics, although he never graduated from highschool. In fact, he does better than me, even though I hold several college degrees. Unfortunatly, he cannot still play the pipe organ. It's a matter of priorities! Take or discard this information for what you find it worth. Realize that you are quite fortunate to live in the age of the Internet. I provides very exceptional educational opportunities. Use it or lose it. Harry C.
On Jul 12, 6:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote:
> How to detect turning points in curves
[snip] Try news:comp.graphics.algorithms (read their faq first, of course) It's done in cartography all the time to thin vectors down to their most salient points, so news:comp.infosystems.gis might also be helpful. Since you don't know the answer, I guess you have not taken calculus. So a third possibility might be news:sci.math.num-analysis if you want to understand the underlying principles.
On Jul 13, 9:42 am, "hhc...@yahoo.com" <hhc...@yahoo.com> wrote:

[...]

I felt like mentioning that he could also find out where the turning
points are by looking for exceedingly large first derivatives. Like
with his example,the first derivative would be infinity /
theoretically/ at the jump, but with a computer it would be "large".
But I was beaten to the punch, and didn't feel like arguing.

> > EE's tend to prefer Laplace tranforms, physicists seem to prefer > Hamiltonians and others. There are actually quite a few. My knowledge > of theoretical analysis is becoming rather dated since it is circa > 1970, so Eric is a far better current source. Still, my methods help > to place man on the moon, and allow vehicles from earth to orbit > distant planets, so their is something to be said for it. Just think > about this: How many points of infelction encounted on the flight of a > space probe launched from earth with a goal of orbiting one of Mar's > moons? That is, how many times does the trajectory change slope, > direction, and velocity?
Classical physics hasn't changed at all in 40 years. What you knew then is still valid, barring being garbled with age :> The physics that put men on the moon is just as valid today. [...]
> > Take or discard this information for what you find it worth. Realize > that you are quite fortunate to live in the age of the Internet. I > provides very exceptional educational opportunities. Use it or lose > it.
The sum of humanities knowledge is at your fingertips. Some understand this, most do not. Plus Amazon isn't *that* good. http://half.ebay.com serves me very well for my textbook needs.
> > Harry C.
In sci.physics user923005 <dcorbit@connx.com> wrote:
> On Jul 12, 6:33 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: > > How to detect turning points in curves > [snip]
> Try news:comp.graphics.algorithms (read their faq first, of course)
> It's done in cartography all the time to thin vectors down to their > most salient points, so news:comp.infosystems.gis might also be > helpful.
> Since you don't know the answer, I guess you have not taken calculus. > So a third possibility might be news:sci.math.num-analysis if you want > to understand the underlying principles.
While calculus would be nice for greater understanding, solving the problem doesn't require any math past analytic geometry and the concept of slope of a line and maybe best fit to a line depending on how far you want to go in the analysis; this is a rather simple problem. -- Jim Pennino Remove .spam.sux to reply.