File Exchange

image thumbnail

regressionp

version 1.0.0 (2.08 KB) by Marko Hecht
polynomial regression calculation

5 Downloads

Updated 03 Dec 2019

View License

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 (2019). regressionp (https://www.mathworks.com/matlabcentral/fileexchange/73531-regressionp), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux