calculates polynomial regression function
input: x [m x 1 double]: x-values of input data
y [m x 1 double]: y-values of input data
n [1 x 1 double]: order of polynomial regression line
default is set to 1
output: Y [1 x 1 symfun]: regression line as matlab function
R [1 x 1 double]: squared mean mistake
written by Marko Hecht, Karlsruher Institute of Technology, November 2019
I basically only implemented the content of explanation given on this webpage:
http://polynomialregression.drque.net/math.html
The function is not perfect though because I solve the least squares problem by inverting the weighted parameter matrix to multiply it with the y-values to receive the solution. As some parameters may be close to zero, Matlab issues a warning in the command window. Any suggestions as to how to solve this more elegantly are very welcome.
Important: this function is not meant to extrapolate!
Cite As
Marko Hecht (2024). regressionp (https://www.mathworks.com/matlabcentral/fileexchange/73531-regressionp), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Elementary Math > Polynomials >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |