[Math] Fitting data with Cosine

trigonometry

So I'm trying to wrap my head about Graphing Cos and Sin but I have several questions about graphing. I know that the Formula is

$$Y= A \sin (t \pm h) + K$$

where $A$ is Amplitude , $t$ is Period, $h$ is horizontal shift, $k$ is the mid line.

I have the following data…
enter image description here

I know for fact the following…

Highest Point $= 73$

Lowest point $= 43$

Amplitude $= (73 – 43) = 30$

Midline $= (A/2 + 43) = 30/2 + 43 = 58$

Now the problem is putting all the information together…

$y = 15 \cos (t \pm h) + 58$

my question is figuring the Period and Horizontal shift?

I think $t$ (period), is the number of cycles between $0$ and $24$ so it's $24/1$

$t= 24/1 = 24$

but the graph shrinks?

I'm having trouble understanding how to obtain t- period and h- horizontal shift.

Most of the graphs on the internet use $2\pi/$(# of intervals).

Best Answer

The technique for fitting depends on what your goal is and how the data works. Are you just trying to describe the data with some notion of how closely the description matches? Are deviations from your ideal description due to random errors of some sort, or finer detail?

The most basic form of statistic used in these circumstances is the sum of the square deviations:$$s^2 = \sum_{i=1}^N [y_i - f(x_i, \mathbf{a})]^2,$$ where $\mathbf{a}$ is some set of parameters that control the behavior of the model, $f$. Making the model as close to the data as possible, for this definition of closeness, is a minimization problem about which much has been written for least squares in particular and the problem of optimization in general (including when solving the system of equations from taking derivatives is not feasible).

For your particular problem, you can use a trig identity to write the model in another form: $$\begin{align} f(x) & = A \sin\left(\frac{2\pi x}{\lambda} + \phi\right) + K \\ & = B\sin\left(\frac{2\pi x}{\lambda}\right) + C \cos\left(\frac{2\pi x}{\lambda}\right) + K, \end{align}$$ with $\lambda$ the period/wavelength. trig identites relate the constants as:$$\begin{align} B &= A\cos\phi,\ \mathrm{and}\\ C &= A\sin\phi.\end{align}$$ The reason for switching to $B$ and $C$ is because the data is linear in them, making them easier to fix.

Related Question