View Single Post
  #3   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Amedee Van Gasse wrote:
I have an XY-chart with data points that are very near a sine wave.
I would like to fit a sine wave trendline to the chart, and also get
the amplitude and the period from the formula of the sine wave.

Or perhaps I should work the other way around? First determine the
parameters for the sine wave function and then create a second series
of data points to be plotted on the chart?

Any suggestions and (simple!) examples are welcome.


-----------------

Expanding a little on Bernard's response, I would proceed as follows.

1) have a column of your data points you're trying to fit.

2) Add another column which is a calculated sine wave using amplitude, period
(and phase?) values taken from three cells. Plug a random guess at values into
the cells initially.

3) Add an additional column that calculates an error function between your data
and the sine wave you've created. Conventionally this might be a LSQ
calculation. At the bottom of that column that is one cell with the LSQ overall
error for the fit.

4) Use Solver to minimize this LSQ value by manipulating the 3 cells holding
your unknown parameters -- amplitude, period and phase.

If there is also some DC offset and or slope to the data that is easy to also
incorporate into the system. That exercise is left to you...

Good luck...

Bill