Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everybody,
I need to calculate the distance between each peaks of an irregular sinusoidal wave, similar to this one http://imageshack.us/photo/my-images/528/grapha.jpg , where each peak is represented by a red dot. I am a very beginner with excel so I am already sorry for my questions. I have the graphs (and I also would like to show on the graph each peak, as in the picture above I simply put a big red dot with Paint) and all the values of the curve, obviously. I am looking for a function/algorythm to calculate these peaks and their distance, as I need to do a similar task with several graphs. These datas are taken from a gyroscope, a device to measure (also) changes in angles; for its intrinsic characteristics, it tends to drift (without a linear pattern, even it may seem linear). Any helps would be more than appreciated! Federico |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Nov 9, 5:22*am, federico tiso wrote:
Hello everybody, I need to calculate the distance between each peaks of an irregular sinusoidal wave, similar to this onehttp://imageshack.us/photo/my-images/528/grapha.jpg , where each peak is represented by a red dot. I am a very beginner with excel so I am already sorry for my questions. I have the graphs (and I also would like to show on the graph each peak, as in the picture above I simply put a big red dot with Paint) and all the values of the curve, obviously. I am looking for a function/algorythm to calculate these peaks and their distance, as I need to do a similar task with several graphs. These datas are taken from a gyroscope, a device to measure (also) changes in angles; for its intrinsic characteristics, it tends to drift (without a linear pattern, even it may seem linear). Any helps would be more than appreciated! Federico Good question... If I were doing this, I would take the differential of the wave. If you had an actual function of the wave form and you took the differential of it, the differential value would be equal to zero at each peak, both positive and negative. So, let's say the wave is represented by an array 100 elements long. The first differential would be [Y(2)-Y(1)]/time. You could do this with a For loop. The example below is sort of crude, but it will get you in the ball park. Y=sine values T = time values tol = tolerance value tol=.1 peak_n = counter value For i = 2 to 100 dS=(Y(i)-Y(i-1) )/(time(i)-time(i-1)) if dS<tol, then peak = time(i) peak_n=peak_n+1 worksheets(1).cells(peak_n,1) end if next |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Nov 10, 6:15*am, Andrew wrote:
On Nov 9, 5:22*am, federico tiso wrote: Hello everybody, I need to calculate the distance between each peaks of an irregular sinusoidal wave, similar to this onehttp://imageshack.us/photo/my-images/528/grapha.jpg , where each peak is represented by a red dot. I am a very beginner with excel so I am already sorry for my questions. I have the graphs (and I also would like to show on the graph each peak, as in the picture above I simply put a big red dot with Paint) and all the values of the curve, obviously. I am looking for a function/algorythm to calculate these peaks and their distance, as I need to do a similar task with several graphs. These datas are taken from a gyroscope, a device to measure (also) changes in angles; for its intrinsic characteristics, it tends to drift (without a linear pattern, even it may seem linear). Any helps would be more than appreciated! Federico Good question... If I were doing this, I would take the differential of the wave. *If you had an actual function of the wave form and you took the differential of it, the differential value would be equal to zero at each peak, both positive and negative. So, let's say the wave is represented by an array 100 elements long. The first differential would be [Y(2)-Y(1)]/time. *You could do this with a For loop. *The example below is sort of crude, but it will get you in the ball park. Y=sine values T = time values tol = tolerance value tol=.1 peak_n = counter value For i = 2 to 100 dS=(Y(i)-Y(i-1) *)/(time(i)-time(i-1)) if dS<tol, then peak = time(i) peak_n=peak_n+1 worksheets(1).cells(peak_n,1) end if next I made a mistake on my example from yesterday. For i = 2 to 100 dS=(Y(i)-Y(i-1) )/(time(i)-time(i-1)) ' This calculates the differential at each point, starting at item 2 if abs(dS)<tol, then peak = time(i) ' See if the differential is less than the tolerance value. If true record time of peak (or x axis value) peak_n=peak_n+1 ' If it is, then increment the number of peaks found worksheets(1).cells(peak_n,1)=peak ' Put the time value onto a worksheet end if next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sine wave trendline | Charts and Charting in Excel | |||
hot to calculate peaks of an "irregular" sine wave | Excel Worksheet Functions | |||
Chart Animated Sine Wave | Charts and Charting in Excel | |||
sine wave trendline | Excel Discussion (Misc queries) | |||
Macro to "Stop Playing" wave files | Excel Programming |