MHB Fitting a function to a sinusoidal curve

AI Thread Summary
To fit a sinusoidal curve using the function f(t)=A[1+B cos(ω₁t+φ)] cos(ω₂t+θ), a user suggests using Excel or LibreOffice Calc's Nonlinear Solver. The setup involves organizing time values, data points, and parameters in specific columns, then minimizing the sum of squared differences between the actual data and the fitted curve. An additional idea involves using Fourier series to reproduce the trace from harmonics and their amplitudes, with a focus on determining the constant a₀. The discussion emphasizes practical techniques for curve fitting and the mathematical relationships involved.
bugatti79
Messages
786
Reaction score
4
Hi Folks,

I have a curve that varies sinusoidally calculated from a numerical program as attached "Trace.png". I would like to fit this amplitude modulation expression to it.

f(t)=A[1+B \cos(\omega_1 t+ \phi)] \cos(\omega_2 t+ \theta)

I managed to adjust the parameters manually to get a very similar curve but couldn't exactly match it. Is there a mathematical technique I could use or is it possible at all?

Thanks
 

Attachments

  • Trace.png
    Trace.png
    5.2 KB · Views: 102
Mathematics news on Phys.org
I would use Excel or LibreOffice Calc's Nonlinear Solver routine to solve this problem. Here's the setup:

Column A contains your time values.
Column B contains your data points.
Column C contains the various parameters you can vary, such as $A, B, \omega_1, \omega_2, \phi,$ and $\theta$.
Column D contains the formula you want to fit, all depending on values from Column C (you'll have to populate Column C with initial guesses). Don't forget to use, e.g.,
Code:
$C$1
to retrieve the value from C1.
Column E contains the square of the differences between Column B and Column D. Sum this column at the bottom.

That's the setup. Next, you invoke the Solver routine, and minimize the sum of squares at the bottom of Column E by varying the cells in Column C. If you're in LibreOffice Calc, you have to tell Calc to use a nonlinear solver, or else you'll get an error.

See if that works for you.
 
Ackbach said:
I would use Excel or LibreOffice Calc's Nonlinear Solver routine to solve this problem. Here's the setup:

Column A contains your time values.
Column B contains your data points.
Column C contains the various parameters you can vary, such as $A, B, \omega_1, \omega_2, \phi,$ and $\theta$.
Column D contains the formula you want to fit, all depending on values from Column C (you'll have to populate Column C with initial guesses). Don't forget to use, e.g.,
Code:
$C$1
to retrieve the value from C1.
Column E contains the square of the differences between Column B and Column D. Sum this column at the bottom.

That's the setup. Next, you invoke the Solver routine, and minimize the sum of squares at the bottom of Column E by varying the cells in Column C. If you're in LibreOffice Calc, you have to tell Calc to use a nonlinear solver, or else you'll get an error.

See if that works for you.

HI Ackbach

THanks, I will give it a go.
 
Hi Folks,

An additional idea cross my mind regarding the attachment "trace.png".

This curve comes from a numerical program which converts this trace to the frequency domain and plots all the harmonics $n_k \omega t$ and their amplitudes $a_n$, $b_n$.

What I would like to do is take these harmonics and their amplitudes and enter them into the Fourier series below to reproduce the same trace

x_t=d_0+d_1 \cos( n_1\omega t - \phi)+d_2 \cos( n_2\omega t - \phi)+d_3 \cos( n_3\omega t - \phi)+...

where $d_0=a_0/2$, $d_n=\sqrt (a_n^2+b_n^2)$ and $\phi_n=tan^{-1} (b_n/a_n)$

However, how would I determine $a_0$?
 
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Back
Top