Hilbert Matrix in least squares polynomial regression
7 次查看(过去 30 天)
显示 更早的评论
When approximating the polynomial x^2+3x+2 with a least squares polynomial of degree two in [0 1], the coefficient matrix of the resultant linear system is a 3x3 Hilbert Matrix. Vector b is as follows as generated by the approximation problem. I should get an approximating polynomial almost like the original one, but the coefficients are quite afar from 2, 3 and 1. I know Hilbert Matrices are ill-conditioned. What can I do? (I am using
where n is the degree of the approximating polynomial,
is the function to be approximated and
)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/594985/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/594990/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/594995/image.png)
A=[1 1/2 1/3;1/2 1/3 1/4;1/3 1/4 1/5];
b=[16/3; 9/4; 97/60];
A\b
ans =
15.5000
-51.000
46.000
0 个评论
回答(1 个)
John D'Errico
2021-4-23
编辑:John D'Errico
2021-4-23
Is A really a hilbert matrix? LOOK CAREFULLY AT WHAT YOU WRITE!!!!!!!!!
In fact, A is not even a valid 3x3 matrix. If you fail to show valid syntax, is there a way we can realistically help you? How do we know what you tried?
A=[1 1/2 1/3;1/2 1/3 1/4;1/^1/4 1/5]
This is a 3x3 hilbert matrix.
hilb(3)
ans =
1 0.5 0.33333
0.5 0.33333 0.25
0.33333 0.25 0.2
Is a 3x3 hilbert matrix truly ill-conditioned?
cond(hilb(3))
ans =
524.06
No.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!