This repository contains a MATLAB project for polynomial curve fitting using the Particle Swarm Optimization (PSO) algorithm.
The Polynomial Curve Fitting project aims to fit a polynomial curve to a given set of data points using the PSO algorithm. The project consists of the following scripts:
CreateModel.m
: This script generates the data for curve fitting and saves it asModel.mat
.Main.m
: This script reads the generated data, allows you to specify the degree of the polynomial curve, and applies the PSO algorithm to fit the curve.
-
Clone the repository:
git clone https://github.com/Ilia-Abolhasani/polynomial-curve-fitting.git
-
Open MATLAB software.
-
Set the current directory to the location where you have cloned the repository.
To use the Polynomial Curve Fitting program, follow these steps:
-
Run the
CreateModel.m
script.- This script generates the data required for curve fitting and saves it as
Model.mat
.
- This script generates the data required for curve fitting and saves it as
-
Open the
Main.m
script in MATLAB. -
Load the generated data by uncommenting the relevant code or use your own data.
-
Specify the degree of the polynomial curve you want to fit by setting the
Degree
variable.- Choose from the following values: 1, 2, 3.
-
Run the
Main.m
script.- The program applies the PSO algorithm to fit the polynomial curve to the data.
-
The fitted curve will be displayed on a graph.
-
Analyze the results and evaluate the quality of the curve fitting for different degree values.
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
-
Fork the repository.
-
Create a new branch for your feature or bug fix.
-
Make your changes and commit them with descriptive messages.
-
Push your changes to your forked repository.
-
Submit a pull request explaining your changes.
Please ensure that your contributions align with the coding standards and guidelines followed in this project.
This project is licensed under the MIT License.