PolyFit is a C library designed to facilitate accurate polynomial fitting for curve approximation, allowing for interpolation and extrapolation of data points. With just a few input datapoints, you can model your system quickly and efficiently.
Sound a bit asbtract? No worries, here's some examples of where PolyFit might help solve your problem.
Signal Processing and Filtering
- Biomedical engineers use polynomial filters to remove noise from electroencephalogram (EEG) signals within neuroscience research, improving the detection of brainwave patterns and facilitating the diagnosis of neurological disorders.
Financial Modeling and Time Series Analysis
- Financial analysts utilise polynomial regression models to analyse market data and predict prices. For example, in investment banking, polynomial models are employed to forecast future stock prices, aiding investors in making informed trading decisions.
Robotics and Path Planning
- Autonomous drones use polynomial trajectories for path planning in search and rescue missions. For instance, in disaster response scenarios, drones navigate through complex environments by following smooth polynomial paths, enabling efficient search operations and rescuing survivors. Think:
- feature trajectory estimation;
- motion model for localisation;
- map building and refinement; and
- sensor calibration.
Transform Functions and Control Systems
- This was the original purpose of the library; to generate transfer functions for systems. Woo!
- Polynomial models are vital in representing system transfer functions, which describe the relationship between inputs and outputs of a dynamic system. By mapping polynomials to transfer functions, engineers can model the behavior of diverse systems across various domains, including aerospace, automotive, and industrial control.
- For instance, in control systems engineering, polynomials are transformed into transfer functions to characterise the dynamics of physical systems, such as aircraft, vehicles, and manufacturing processes! These transfer functions capture the system's response to inputs and enable engineers to design control algorithms to achieve desired performance objectives, such as stability, responsiveness, and robustness.
- With transfer functions derived from polynomials, engineers can perform advanced control systems analysis techniques, such as Root-Locus, frequency response analysis, and pole-zero analysis.
- Polynomial fitting for curve approximation.
- Interpolation and extrapolation functionality for predicting additional data points.
- Lightweight and easy-to-integrate into existing C projects.
Clone the repository:
git clone https://github.com/FinOrr/polyfit.git
Copy the polyFit.c and polyFit.h files into your project directory.
Include the polyFit.h header file in your source files where you want to use the polynomial regression functionality.
#include "polyFit.h"
See the demo.c program for example usage. To build the demo, you'll need CMake installed.
Open a terminal, navigate to the directory containing your source files and the CMakeLists.txt, and run the following commands:
mkdir build
cd build
cmake ..
This will generate the build files. Once the files are generated, you can build your project by running:
make
This will compile your source files and create the executable. If you want to clean the generated files, you can run:
make clean
The resulting executable will be in the build directory.
Detailed documentation can be found in the Wiki.
Contributions are welcome! Please check the Contribution Guidelines before making a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries or support, please use the Issues page.