Building data and performing least squares regression with cosines in java

I have data that I would like to build, and, more importantly, least squares regression when using cosines (instead of using polynomials):

http://imgur.com/AkEaE.png

Any recommendations? Thanks.

+4
source share
4 answers

Probably the following page solves the regression part of your goal:

http://www.teneighty.org/software/index.html?f=fft&c=e98b8

+1
source

You can find this demo β€œLeast Squares and Fitting Data” as it solves some of your problems.

0
source

Just a bit of cautionary advice. Using the Fourier series makes sense if you think that your basic function has a cosine series as the basis; however, if you use it as the basis for an arbitrary function (with an unknown shape), you can try to guess a more specific basic type of function (polynomial, exponential, etc.).

I did some limited optimization on such a series, and the function was so distorted that it was hard to say if my fit was significant; my matching function had a large number of local maxima.

0
source

MathGL can be built, placed (using GSL) and show the result of the finish - see this sample.

0
source

Source: https://habr.com/ru/post/1311783/


All Articles