3
$\begingroup$

How can I find the equation of this function.

I assume I will need to work out coordinates for each peak?

The function is a decaying cos graph of the form:

$f(x) = Ae^{kx} \cos(Bx+C)+D.$

Any help would be appreciated!

  • 0
    The value of $D$ looks like about 83 or 84; you can get things like that by staring at it. Horizontal distances from trough to trough and from peak to peak will tell you what number $B$ is.2011-08-04

3 Answers 3

10

Edited in response to Parachuting Panda's comment, and in the spirit of my comment "If you want to use $f(x)$ as it is, then you could adjust it to let's say $x_{4}$ and $x_{14}$".

If we consider $x_{4}\approx 24.3$, $f(x_{4})\approx 101.4$ and $x_{14}\approx 85.3$, $f(x_{14})\approx 91.4$ and compute in a similar way as below, from

$\begin{eqnarray*} f(x_{4}) &\approx &101.4\approx Ae^{kx}\cos (Bx)+83.4 \\ f(x_{14}) &\approx &91.4\approx Ae^{kx}\cos (Bx)+83.4 \end{eqnarray*},$

with the same $B\approx 0.517$, we get $k\approx -1.33x/100$ and $A\approx 24.9$:

$f(x)\approx 24.9e^{-1.33x/100}\cos (0.517x)+83.4.\qquad (\ast\ast)$

But $f(0)\approx 108.3$, and $f(x_{18})=f(109.4)\approx 89.2$ which deviates too from the the given curve. My conclusion is that almost for sure $f(x)$ cannot be of the form $f(x)=Ae^{kx}\cos (Bx+C)+D.$

Here are the graphs of $(\ast\ast)$ (green) and $(\ast)$ (blue) and the peaks of the given curve (red circles):

enter image description here


The maxima and minima of $f(x)$ are attained at equally spaced points $x_{p}$ ($p=0,1,\ldots $). Since $f(0)$ seems to be the first maximum (in some applications it so happens), then $x_{0}\approx 0,C\approx 0$ and $x_{p}\approx\frac{p\pi }{B}$. The horizontal distance between peaks is $X=\frac{2\pi }{B}$.

enter image description here Vertical offset $D\approx 83.8$, Distance between two peaks $X\approx 12.2$

To minimize errors we consider the $9^{th}$ maximum after $x_{0}$. It occurs at $x_{18}=\frac{18\pi }{B}\approx 109.4$. Hence $B\approx 0.517$ and $X\approx 12.2$. If we use the $1^{st}$ and $10^{th}$ minima instead, for a function such as $f(x)$ we should have $x_{19}-x_{1}=x_{18}-x_0$. Within the margin of error of this method these differences are equal. Hence

$f(x)\approx Ae^{kx}\cos (0.517x)+D.$

Also, on the graph $f(0)\approx 120$, so $A+D\approx 120$. The straight line $y=D$ crosses the graph of $f(x)$ at equally spaced points. Two successive points are $\frac{X}{2}=\frac{\pi }{B}\approx 6.08$ apart. The distance from the first to the $19^{th}$ must be $\frac{18\pi }{B}\approx 109.4$. Using this information we try to adjust the position of that line and find $D\approx 83.4$. Then $A\approx 120-83.4=36.6$ and $f(x)\approx 36.6e^{kx}\cos (0.517x)+83.4$.

For $C\ne 0$ the graphs of the functions $u(x)=36.6e^{kx}+83.4$ and $v(x)=-36.6e^{kx}+83.4$ would touch the graph of $f(x)$ a little bit after the peaks (see sketch below). But our initial assumption implied that $C=0$, so this does not happen in the present case. From

$\frac{f(x_{0})-D}{f(x_{18})-D}=\frac{e^{kx_{0}}}{e^{kx_{18}}}=\frac{1}{e^{kx_{18}}}=\frac{1}{e^{k\frac{18\pi }{B}}}\approx \frac{1}{e^{109.4k}},$

and using $f(x_{0})\approx f(0)\approx 120$ and $f(x_{18})\approx 90$, $\frac{120-83.4}{90-83.4}\approx \frac{1}{e^{109.4k}}$ we get $k\approx -1.57/100$. Therefore the numerical formula is

$f(x)\approx 36.6e^{-1.57x/100}\cos (0.517x)+83.4\qquad (\ast)$

and the corresponding graph

enter image description here Graph of $f(x),u(x),v(x)$

Sketch of a damped harmonic oscillator for the same type of curve but with "touching" points different from maxima and minima.

enter image description here Damped harmonic movement. For $C\ne 0$ and $D=0$.

  • 0
    @J. M.: Thanks! It seems to me that the best I can is to conclude that "almost for sure $f(x)$ cannot be of the form $f(x)=Ae^{kx}cos(Bx+C)+D$.2011-08-07
6

You plug the values into Eureqa (link here) and let it find the function for you.

I pluged the table of values from (my example) Decaying Function

And it found the solution

Solutions

With pretty good fitting:

Calculation Output

The original function I used in Excel was =0.8+0.8*EXP(-'t'/4)*(2*COS(PI()*'t')).

Eureqa solution: 0.80000001 + 0.79978114*cos(-6.2831697*t)*exp(-0.25*t)

The results are impressive as you can see the 0.8 the 2*PI() and the 1/4.

  • 0
    +1 your answer suggests to me that the function $f(x)$ may be not of the form OP assumed.2011-08-07
4

One way is to use a multidimensional minimizer: collect a bunch of points, create a function of $A, B, C, D, k$ that sums the squared errors, and minimize it. Such routines are available in any numerical analysis text, or in Excel.

To do it by eye, Eivind gave you a start. It looks like $D$ is about $82$ (taking the center of the wiggles), $C$ is $0$ (assuming the start has a flat tangent-maybe it is $-3$ or so), $9$ waves end at $x=108$ so $B=2\pi/12$, the amplitude drops by about a factor of $4$ in $100,$ so $e^{100k}=0.25, k=-.014$ and from the first wave $A$ is about $35$.

  • 0
    I correct myself. If $C=0$ "the maxima and minima" do not "occur a little bit to the left of the touching points of f(x)".2011-08-05