Solving a math problem with two unknowns using matlab (linear least square/optimization)
显示 更早的评论
Consider these equations:
-7.02 = -(49.600)*(A) + (-0.2213)*(B)
-7.84 = -(68.809)*(A) + (-0.2213)*(B)
-6.27 = -(63.307)*(A) + (-0.1510)*(B)
-7.33 = -(65.438)*(A) + (-0.1468)*(B)
I'm sorry its really basic but i don't know how to solve it in matlab. Could you please write the answer and show the code and how you arrive at your answer? HINT: B will be close to 0.40!!
Please help me out here.
Thanks a lot in advance!!!
回答(1 个)
Paulo Silva
2011-5-7
I=[-7.02
-7.84
-6.27
-7.33];
D=[-49.600 -0.2213
-68.809 -0.2213
-63.307 -0.1510
-65.438 -0.1468];
s=D\I; % s=linsolve(D,I) %same result
fprintf('A=%f and B=%f\n',s(1),s(2))
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!