Regression on multi-variable data
2 views (last 30 days)
Show older comments
Hello I have a set of data that looks like this:
I want a model of the form
M(x, y, x) = p*(x^0.5) + q(y^0.5) + s(z^0.5)
-> all the exponents are equal to 0.5
where p, q and s are the coefficients that I am looking for.
Each x, y, z, M is a experimental data point, therefore there exist some error in the data, and I want the model with the best fit from which I can calculate the overal error.
How can I obtain this ?
I greatly appreciate your suggestions
0 Comments
Answers (1)
Star Strider
on 15 Aug 2019
This is a linear problem, so a linear solution will work.
Try this:
M = [1.48 1 0.9 0.69 0];
x = [8.526 5.6 6.9654 7 0];
y = [0.105 2.8 1.7838 0 0];
z = [0.348 0.21 0 .02 0.25];
B = sqrt([x(:) y(:) z(:) ones(5,1)]) \ M(:);
p = B(1)
q = B(2)
s = B(3)
intcpt = B(4)
Mfit = sqrt([x(:) y(:) z(:) ones(5,1)]) * B;
Resid = M(:) - Mfit
producing:
p =
0.443190863040845
q =
0.075119847669093
s =
0.931994338072853
intcpt =
-0.488034944641904
Resid =
0.099808696536123
-0.113539064951291
0.118034358405705
-0.126341765596015
0.022037775605478
There are too many dimensions to plot, however the residuals indicate the the fit is reasonably good.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!