I have to run a regression of order 5. My X matrix is
My Y matrix is
Both X and Y are approxiately 20×1, I just wanted to give an idea how they look like.
I have tried the following:
1. Beta=pinv(X'*X)*(X'*Y);2. Beta=(X'*X)\(X'*Y);3. Beta=(X*Y);4. Beta=polyfit(X,Y,5);Expected=polyval(Beta,X);
The results are very different. Additionally polyfit/polyval shows the following warning:"Warning: Polynomial is not unique; degree >= number of data points"
Any ideas or suggestions of what am I doing wrong or how or what else can I try? What is the correct way to do it?