Least Square Method Calculation
To clone this repository run:
git clone https://github.com/ajlekcahdp4/LSM.git
cd LSM
You can install gnuplot by apt / apt-get:
sudo apt install gnuplot
Or by pacman (On Arch and Manjaro linux):
sudo pacman -S gnuplot
libQt5Core.so.5
use this reccomendations.You can install cmake by apt / apt-get:
sudo apt install cmake
Or by pacman (On Arch and Manjaro linux):
sudo pacman -S cmake
main
file. In this case:To compile this program run:
cmake .
make
And then to run it use:
./calc
The program will ask you about type of aproximation (managed linear, exponential and any-degrees polinomial), input file name, output file name, abscissa axis label, ordinate axis label and degree of the polinom (in polinomial approximation case)
You have to write measured points in a file this way: 1) The decimal separator should be a dot, not a comma. 2) Write abscissa and ordinate values in columns like this
Point number | X | Y |
---|---|---|
1 | 1.0 | 1.2 |
2 | 2.0 | 9.0 |
3 | 3.0 | 26.0 |
4 | 4.0 | 67.0 |
5 | 5.0 | 116.0 |
After the program is completed, information about the calculation performed using the least squares method will be written to the file that you specified as output.
The output file will look like this:
example of the output file for polinomial approximation:
example of the output file for linear approximation:
example of the output file for exponential approximation:
And also you will get the graph of your approximation:
example of the polinomial graph:
example of the exponential graph:
example of the linear graph:
My program also can managed hight-levels polinoms. In the example down below I approximate this points:
X | Y |
---|---|
1.0 | 2.0 |
2.0 | 2.0 |
3.0 | 3.0 |
4.0 | 5.0 |
5.0 | 5.0 |
6.0 | 6.0 |
7.0 | 8.0 |
8.0 | 9.0 |
9.0 | 10.0 |
10.0 | 12.0 |
11.0 | 10.0 |
12.0 | 12.0 |
13.0 | 12.0 |
14.0 | 14.0 |
15.0 | 17.0 |
16.0 | 16.0 |
17.0 | 18.0 |
18.0 | 17.0 |
19.0 | 19.0 |
20.0 | 19.0 |
with the 8-degree polinom.
If you faced some bugs with this program - please, create a bug report in the issues and I'll try to help you.
If you have an idea how to improve this project - please, write it in issue or fork this repository, write code and create pull request.