0

I am trying to develop in java the sinusoidal regression algorithm described by Jean Jacquelin: https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales For my use, the '$a$' parameter is useless. So I modified equations 1 to 24 (pages 21 to 2) accordingly.

In my implementation, sometimes it works very well. Sometimes it fails. I'm having trouble finding the bug when rereading.

Could anyone test these values? (which arrive at $\omega = 0.648$ and $\phi = 1.35$ while by hands, $0.81$ and $4.2$ seem closer to reality)

Thanks in advance

\begin{array} {|r|r|}\hline { 11.87579, 0.94993 } & { 12.24713, 0.99985 } & { 12.32558, 0.99891 }& { 13.27073, 0.68795 }& { 13.43532, 0.58538 }& { 13.92164, 0.22937 } \\ \hline { 14.89322, -0.52740 }& { 15.00233, -0.60033 }& { 15.53425, -0.87948 }& { 16.16189, -0.99992 }& { 16.35611, -0.98563 }& { 16.67109, -0.91111 } \\ \hline { 17.36284, -0.55274 }& { 17.78438, -0.24178 }& { 18.07335, -0.01014 }& { 19.06969, 0.71518 }& { 19.87356, 0.99247 }& { 19.88252, 0.99333 }& \\ \hline { 20.65666, 0.87199 }& { 21.1622, 0.60500 }& { 21.44818, 0.40604 }& { 21.99664, -0.02612 }& { 22.01315, -0.03949 }& { 23.00046, -0.74412 } \\ \hline { 23.85489, -0.99922 }& { 24.54297, -0.86888 }& { 24.60116, -0.84459 }& { 25.30864, -0.41936 }& { 25.59536, -0.19915 }& { 25.63645, -0.16643 } \\ \hline { 26.63189, 0.59646 }& { 27.62896, 0.99231 }& { 28.25732, 0.92683 }& { 29.20814, 0.40386 }& { 29.96497, -0.19601 }& { 30.18675, -0.36807 } \\ \hline { 31.00362, -0.86169 }& { 31.08351, -0.89270 }& { 31.46208, -0.98709 }& { 31.89921, -0.98138 }& { 32.84455, -0.57437 }& { 33.45334, -0.11844 } \\ \hline \end{array}

  • Replace Jean Jacquelin by @JJacquelin to draw his attention – Claude Leibovici Oct 25 '23 at 06:19
  • The cause of the failure with this data is clear : The method is based on numerical integration ( To compute $S_k$ and $SS_k$ ). The points are too far from one to the next one. So the numerical values of $S_k$ and $SS_k $ are far to be accurate enough. This causes big deviations in further calculus for $\omega$. The method of regression with integral equation is not convenient in this case. – JJacquelin Oct 25 '23 at 08:15
  • @Claude Leibovici. Hi Claude! Glad to meet you on this occasion. I guess that you will have an clever answer to the question with one of your pragmatic methods. Best regards. – JJacquelin Oct 25 '23 at 08:30
  • @JJacquelin. Hi Jean ! I was sure that this was the reason but I prefered you make the answer or comment on it. I shall ask the OP if he wants a solution. Cheers :-) – Claude Leibovici Oct 25 '23 at 08:49
  • Do you want or need a robust method for fitting $y=a \sin(bx)+c \cos(bx)$ ? – Claude Leibovici Oct 25 '23 at 08:51
  • @JJacquelin : Merci :) Is there a way, a priori, to know that the points are too far from each other ? – Arnaud M Oct 25 '23 at 12:42
  • @Claude Leibovici : If you have a paper on the subject, I will definitely read it – Arnaud M Oct 25 '23 at 12:44
  • I do not have any paper but if this is your model, I can write something. – Claude Leibovici Oct 25 '23 at 13:01
  • I don't really need a method for fitting y = sin(ω x + φ) I found it fun to implement the method described by @JJacquelin; I didn't want to stop on buggy code. – Arnaud M Oct 25 '23 at 15:58
  • @Arnaud M . The numerical integration used here is a step integration. If the shape of the function is almost straight or slightly curved large steps will only cause negligible deviation of the integration. If the shape is strongly curved the steps have to be small to cause acceptable deviation. In the present case the steps cannot be chosen because they are defined by the given data . I don't know if there a way, a priori, to know if the steps implied by a given data are small enough. Trying the calculus and checking the accuracy of the result is a default solution. – JJacquelin Oct 26 '23 at 08:07

0 Answers0