Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default hot to calculate peaks of an "irregular" sine wave

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default hot to calculate peaks of an "irregular" sine wave

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default hot to calculate peaks of an "irregular" sine wave

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sine wave trendline Amedee Van Gasse Charts and Charting in Excel 8 April 4th 23 02:15 PM
hot to calculate peaks of an "irregular" sine wave federico tiso Excel Worksheet Functions 1 November 16th 11 07:56 AM
Chart Animated Sine Wave TEAM Charts and Charting in Excel 1 August 5th 05 10:35 PM
sine wave trendline Amedee Van Gasse Excel Discussion (Misc queries) 10 July 12th 05 04:01 PM
Macro to "Stop Playing" wave files yo beee Excel Programming 2 November 10th 03 07:05 PM


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"