Fitting points to skewed sinusoids

In summary, the conversation discusses the problem of fitting skewed sinusoids to a set of data points using least square fit. The solution involves using nonlinear regression by linearizing the function using the first few terms of the Taylor series and solving the resulting matrix equation for the unknowns. Other suggestions include using Matlab's curve fitting toolbox.
  • #1
squalho
11
0
Fitting points to "skewed" sinusoids

Hello,

I have a problem related to least square fit of data. Let me start from a step back. I have a set of points, given as x-y coordinates. x represents an angle and y the corresponding value of a function. I am fitting sinusoids to those data points, and I am basically doing it like here: http://www.cheric.org/ippage/e/ipdata/2001/13/node6.html (see Curve Fitting with Sinusoidal Functions)

This works very well. I can reconstruct A0, A1 and B1 without problems. What I get is a sinusoid that represents the least square fit to my data points. Now comes my problem. The sinusoids that I have to fit are "skewed". Given a certain set of data, I have to fit a function of the kind:
[tex]
y = A \cos (\omega + \arcsin (d \sin (\phi - \omega)) - \alpha)
[/tex]
where A is the normal amplitude of the cosine, omega is the pulsation, alpha the phase, d and phi are what cause the "skewness". You can try to plot it to see that this function is like a cosine, but not symmetric.

Now, how would I go about fitting that function to my set of data? The problem is very non-linear and I'm stuck. Any suggestion is very appreciated.

Thanks!
 
Last edited by a moderator:
Mathematics news on Phys.org
  • #2


It would seem you need to use nonlinear regression. Your same link has a topic about it but doesn't say much. I'm sure you can find descriptions via a Google search. Basically, you linearize the function using the first few Taylor series terms using a 'guess' for the solution, form the least squares problem, solve the resulting matrix equation for the unknowns, then repeat until you converge on a solution.
 
  • #3


hotvette,

Thanks for the answer. However, it doesn't seem to me that the problem can be easily linearized. My problem is to find the values of A, phi and alpha. If I used a Taylor series expansion I would end up dividing my problem in many linear interpolators, each one working over a subset of my data. Each solution would give me the coefficients of each linear function (m and q), but then I would be back at the beginning, trying to guess my A, phi and alpha from my collection of m and q.

Does this make sense?
 
  • #4


Matlab's curve fitting toolbox can also do this in a few clicks if you have it. It will even give you the confidence bands :wink:
 
  • #5


squalho said:
However, it doesn't seem to me that the problem can be easily linearized

Sure it can. All that's needed from the Taylor Series is the constant and linear terms. If you have a function f = f(a,b,c) the linearization is:

f ≈ f0 + ∂f/∂a*Δa + ∂f/∂b*Δb + ∂f/∂c*Δc

(evaluated at current 'guesses' for a,b,c), which is linear in Δa, Δb, and Δc. It can be difficult sometimes getting good initial 'guesses' for the unknowns (to get convergence), but usually it can be done with a few attempts. Suggest you find some articles on nonlinear regression. It's actually quite straightforward once you get the hang of it.
 

FAQ: Fitting points to skewed sinusoids

How do I determine if my data follows a skewed sinusoidal pattern?

To determine if your data follows a skewed sinusoidal pattern, you can plot the data points on a graph and visually inspect the shape of the curve. If the curve appears to be asymmetrical and does not follow a typical sinusoidal shape, it is likely skewed. Additionally, you can use statistical tests such as the skewness coefficient to quantitatively measure the degree of skewness in your data.

What methods can I use to fit points to a skewed sinusoid?

There are several methods that can be used to fit points to a skewed sinusoid, including linear regression, nonlinear regression, and least squares curve fitting. These methods involve finding the best fit curve that minimizes the distance between the data points and the predicted values of the curve.

Can I use the same methods for fitting points to a skewed sinusoid as I would for a regular sinusoid?

Yes, the same methods can be used for fitting points to a skewed sinusoid as for a regular sinusoid. However, it is important to note that the parameters used in the fitting process, such as the amplitude and frequency, may differ for a skewed sinusoid compared to a regular sinusoid.

How do I interpret the results of a fitted skewed sinusoid?

The results of a fitted skewed sinusoid can be interpreted similarly to a regular sinusoid. The amplitude represents the maximum deviation of the data from the mean, the frequency represents the number of cycles within a given period, and the phase shift represents the horizontal displacement of the curve. However, it is important to consider the degree of skewness in the data and how it may affect the interpretation of these parameters.

Are there any limitations to fitting points to a skewed sinusoid?

Yes, there are limitations to fitting points to a skewed sinusoid. One limitation is that the fitting process assumes that the underlying data follows a skewed sinusoidal pattern, which may not always be the case. Additionally, the accuracy of the fitted curve may be affected by the degree of skewness in the data and the choice of fitting method.

Similar threads

Back
Top