1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Sine Function with Alternating Peaks and Wavelengths

  1. Aug 12, 2012 #1
    Hi All,

    I'm trying to find a sine function that models the cyclic and seasonal nature of retail sales across the years. I've tried several combinations including some basic attempts at complex plots of sin(x), but am now starting to wonder if there is even a simple solution to the problem. I've searched google for images of plots but maybe I'm not entering the right keywords?

    Anyway I'm gonna have to write out the description. The units right now don't matter since I can't even get the proper shape of the curve. I did a polynomial fit to average monthly data and got the fifth order polynomial that fits the data from x=1 to x=12 (for the months 1 to 12):

    y = -1.225*x^5 + 40.785*x^4 - 479.82*x^3 + 2325.3*x^2 - 4029.5*x + 1554.433 view wolframalpha plot

    I'm basically trying to find a sine function that repeats this basic pattern for every year since I need to then apply time-dependent attenuation and perhaps other functions to it. The closest I got was through complex plots like this:

    y = (sin(pi*x-pi/2)) - re(sqrt(sin(pi/2*(x+2))))^2 view wolframalpha plot

    Will greatly appreciate any help!
  2. jcsd
  3. Aug 12, 2012 #2


    User Avatar
    Homework Helper

    Have you tried fitting your data to a fourier series?

    Fourier series are basically made to find all of the frequency components of periodic data.
  4. Aug 12, 2012 #3


    User Avatar
    Science Advisor

    There won't exit a single sine (or cosine) function that models that but a sum of such functions can (that is the "Fourier series" Mute mentions).
  5. Aug 13, 2012 #4
    I haven't, how do you do that exactly? ;)

    I'll just go ahead and assume that I'm in over my head with the actual math behind this for the moment. I am a programmer however, and found a nifty class that is supposed to perform a "Fast Fourier Transform" which calculates the "discrete Fourier transform". But this is apparently quite different than the fourier series (from a google search).

    Ok, some more searching around and I found this:


    at the bottom of which there is a link to an excel file that basically lays out all the calculations done. This seems to be what I need, and I would appreciate if someone could point out that I'm going in the right direction.

    Many thanks!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook