Sine Function with Alternating Peaks and Wavelengths

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 2K views
hddd123456789
Messages
92
Reaction score
0
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 going to 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!
 
Mathematics news on Phys.org
Mute said:
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.

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:

http://www.public.iastate.edu/~akmitra/aero361/design_web/crvft.html

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!