Need help writing a code
显示 更早的评论
Hello community, this is a problem I have as homework, I have been looking for a way to write this code but I am not sure how to go about this. I am not the best in matlab and need some help. If someone can help me to solve this it would be much appreciated.

回答(1 个)
Roger Stafford
2015-4-28
0 个投票
It would be easy to write the code for this problem, or even to just mention certain matlab functions that would do the job easily for you. However, in my opinion, you will learn the most by working this out for yourself - with a little hint to get you going.
Here is the hint: First, you should determine what it means to do a "least squares fit". What is it that is to be least? After you have written an expression that is to be minimized for least squares fit, you can obtain ten different equations by taking the partial derivatives of that expression with respect to the ten different coefficients and setting each derivative to zero. When you do, you will have ten linear equations in ten unknowns. Solving such equations using matrices is what matlab is all about. Good luck!
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!