Functions – Function to Show 2 Peaks with Different Magnitudes

functionsgraphing-functions

I want to create a function that repeats on an annual cycle (i.e. time is a vector of $1$ to $365$), that has $2$ peaks of different magnitudes – one approx a third of the year and the second approx two thirds of the year. The mean of the cycle is ~$450$, with the $y$-limits being ~$100-800$. The value at the beginning of the year should be the minimum value.

With the help of a much more mathematically-minded friend, I've managed to get the following:

$$\text{MeanValue} + 250\left(\sin\left(\frac{0.2164}{2\pi}\left(\text{time}-55\right)\right)+\left(\sin\left(\frac{0.2164\cdot0.5}{2\pi}\left(\text{time}-55\right)\right)\right)\right)$$

where MeanValue is $450$ and time is the vector of $1$ to $365$.

However, although this seems to show the correct pattern over a small number of years, after $1000$ years, the value at the end of the year is not the minimum value, but ~$700$, implying the whole cycle seems to be about half a phase out by then. What am I missing to make this repeat in the way I want?

Best Answer

The function we are told to model analytically has only been qualitatively described, together with hints about its range and mean. The model proposed here provides a reasonable fitting of this description; but as soon as more "intelligence" about the actual function to be modeled is available, more involved (numerical) methods will have to be used.

Playing around with parameters one finds that the following function of period $2\pi$ suits your description of the graph:

$$f(x)\ :=\ -\cos x-\sin x-{5\over2}\cos(2x)+{1\over2}\sin(2x)\ .$$ This is the graph of $f$:

wave

Now we want the time variable $t$ be days that run from $0$ to $365$ in a full period. This means that $x$ should go from $0$ to $2\pi$ when $t$ goes from $0$ to $365$. Letting $x:={2\pi\over 365}t$ does the trick. Therefore we define a new function $g: {\mathbb R}/(365{\mathbb Z})\to{\mathbb R}$ by means of the formula $$g(t)\ :=\ f\bigl({2\pi\over 365}t\bigr)=\ -\cos{2\pi t\over 365}-\sin {2\pi t\over 365}-{5\over2}\cos({4\pi t\over 365})+{1\over2}\sin({4\pi t\over 365})\ .$$ The resulting graph looks the same, but with a different labeling on the horizontal axis:

wave2

The mean value $(\sim 450)$ and the range $\bigl(\sim[100,800]\bigr)$ are not yet as desired. But this is easy to accomplish: Note that $f$ has mean value zero, and so has $g$. As $f(0)=g(0)=-3.5$ the function $$h(t)\ :=\ 100 g(t)+450$$ fulfills the requirements pretty well: We have $h(0)=100$, mean $450$, and the maximum of $h$ is $\sim810$.

Related Question