Solving a math problem with two unknowns using matlab (linear least square/optimization)
Show older comments
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!!!
Answers (1)
Paulo Silva
on 7 May 2011
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))
Categories
Find more on Linear Least Squares 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!