A lightweight C library for fitting polynomials to data—fast, simple, and no external dependencies.
PolyFit is a small, embeddable C library for polynomial regression. It helps you fit a curve through a set of data points so you can interpolate or extrapolate with minimal effort.
Whether you're smoothing a signal, modeling system behavior, or generating transfer functions, polyfit is built to drop into your project and get out of your way.
Here's a few real-world uses:
Useful in cleaning up noisy data e.g., smoothing biomedical signals like EEGs.
Model sensor noise, trajectory paths, or estimate system motion with smooth, continuous polynomials.
Originally built to model dynamic systems using polynomial-based transfer functions. Great for:
- Root locus
- Frequency response
- Pole-zero plots
- Polynomial curve fitting with configurable order
- Supports both interpolation and extrapolation
- Single-file: just drop in
polyfit.c
andpolyfit.h
- No dependencies beyond the standard library
git clone https://github.com/FinOrr/polyfit.git
Then just copy polyfit.c
and polyfit.h
into your project.
#include "polyfit.h"
More detailed info and examples are available on the Wiki.
Found a bug? Want to improve performance or add features? PRs welcome, just read the contributing guide first.
MIT. See LICENSE for full details.
Open an issue if you get stuck or want to ask anything.