Polyfit minus one term
Show older comments
Hi, and happy new year.
I need a 3rd order polynomiial approximation for the file Data001 in attached.
I can use polyfit but I need a polinomium without the term x^2.
My polinomium must be:
x^3+x^1+x^0.
How can I do that?
Accepted Answer
More Answers (1)
dpb
on 1 Jan 2020
Without toolbox, use backslash operator, \
X=[x.^[3 2 1 0]]; X(:,2)=0; % design matrix straight calculation
b=X\y; % solve for coefficients
If have Stat or Curve Fitting TB, use one of the linear model fitting routines with custom model.
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!