Fitting a sine curve that isn't a perfect sine curve?

  • Context: Undergrad 
  • Thread starter Thread starter Phystudent91
  • Start date Start date
  • Tags Tags
    Curve Fitting Sine
Click For Summary

Discussion Overview

The discussion revolves around fitting a sine curve to a dataset representing an interference pattern, where the data exhibits sine-like properties but lacks regular peak-to-peak distances. Participants explore methods and tools for achieving a fit that accurately represents the data points rather than a generalized average sine curve.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes the challenge of fitting a sine curve to data with irregular peak-to-peak distances and seeks a method or program that can provide a precise fit.
  • Another participant suggests that a standard sine wave model may not accommodate the frequency variation and proposes a modified model function that includes a variable frequency component.
  • A different participant recommends using Fast Fourier Transform (FFT) for data spanning multiple periods, while also noting the challenges of non-linear regression for limited data ranges.
  • One participant proposes extracting the phase from the data and fitting a polynomial function to it, suggesting a method to identify zero crossings and maxima/minima as a potential approach.
  • A participant offers a specific online tool for curve fitting that allows for trigonometric equations, providing a direct link and personal assistance if needed.

Areas of Agreement / Disagreement

Participants express various methods and approaches for fitting the sine curve, but there is no consensus on a single effective solution. Multiple competing views and techniques remain under discussion.

Contextual Notes

The discussion highlights the limitations of standard sine fitting methods in the presence of irregular data patterns and the potential need for customized approaches or algorithms. The effectiveness of suggested methods may depend on the specific characteristics of the dataset.

Phystudent91
Messages
6
Reaction score
0
For my 3rd year project, I have a set of data which is the variation within an interference pattern.
The outcome has clear sine curve properties (Alternating peaks and troughs of intensity) but the positions aren't regular (i.e. the peak-to-peak distance between peak1 and peak2 is larger than the distance between peak2 and peak3).

I have tried using SciDAVis to plot this curve but it finds a best-fit/average kind of sine curve, not a fit that passes through all the available points. Is there a method or program that will help me?

I would preferably be able to make a note of the equation of the curve in order to plot it with other sine curves of the interference pattern from other varying distances from the sources.
 
Physics news on Phys.org
I'm not sure what the program you're using is, but if your specified model function is a sine wave then it won't be able to account for the frequency variation you describe. Can you find any simple relationships between the peak-to-peak distances? The model function might take the form f(x) = a*sin(x*g(x)), where g(x) can be some linear function in x, say, g(x) = bx + c.
 
If your data extends over a number of periods, try Fast Fourier Transform (FFT).
If the data extends over only a narow range (a few periods or only a part of a period) and if the expected function patern is y=a*sin(w*x+b)+c, you may try a non-linear regression in order to compute w, a, b, c. This is a difficult problem. The methods are rarely reliable, depending a lot of the data (number, distribution, scatter). Generally, they use some iterative algorithm :
http://mathworld.wolfram.com/NonlinearLeastSquaresFitting.html
A especially non-iterative algorithm for the sinusoidal case is presented in pages 35, 36 of the paper " Régressions et équations intégrales" :
http://www.scribd.com/JJacquelin/documents
 
Last edited:
What you are trying to fit is probably not enough of a sine wave to fit it like that. What you could do, if the fft doesn't work, is trying to extract the phase \phi(t) and then fit a linear (polynomial) function through it for example. The most simple way to do it, is taking the average value of the function, define it as zero and find the zero crossings. These points represent a phase of \pi,2\pi,3\pi,\dots. You could also do this with the maxima and minima. It is a bit of a hack, but you might get some useful information.
 
Phystudent91 said:
Is there a method or program that will help me?

You can try the "function finder" on my curve and surface fitting web site, http://zunzun.com - it is free and won't cost anything to give it a try. You can limit the function finder to trigonometric equations only. The direct link is:


http://zunzun.com/FunctionFinder/2/

If you need any help with the site, contact me directly:

James Phillips
Personal Info deleted

web: http://zunzun.com

James
 
Last edited by a moderator:

Similar threads

  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 9 ·
Replies
9
Views
8K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 4 ·
Replies
4
Views
22K