Jump to content

Reading waves


cs1h

Recommended Posts

The data will be read in by translating a line in the form of an image into co-ordinates, the data will probably be stored in an array.

 

I want to find all the highs and lows on the graph, so if it was a wave it would find the peaks and dips in it. 

 

In which case you'll want to refer to Mchl's post

Link to comment
https://forums.phpfreaks.com/topic/180966-reading-waves/#findComment-954794
Share on other sites

No, it won't

 

Let's have an example data

 

y 0, 1, 2, 1, 0,-1, 0, 1, 2, 1, 2, 1, 0

x 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12

 

Now you need to calculate a difference between each pair of consecutive data

 

dy 0, 1, 1,-1,-1,-1, 1, 1, 1,-1, 1,-1,-1

x  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12

 

The local minimums and maximums are whenever there is a change of sign in the next element of this array. So on positions 2,5,8,9, and 10

Link to comment
https://forums.phpfreaks.com/topic/180966-reading-waves/#findComment-954844
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.