Curve fit for multiple variables
3 views (last 30 days)
Show older comments
I have an equation of form y=a*(x1^b)*(x2^c)*(x3^d)*(x4^e)
where x1, x2, x3, x4 are variables and y is output. I have all these values experimentally.
I need to fit this equation to calculate optimum values of a, b, c, d and e.
Please provide a suitable matlab code.
0 Comments
Accepted Answer
Andrei Bobrov
on 2 Dec 2014
Edited: Andrei Bobrov
on 2 Dec 2014
x = [x1(:) x2(:) x3(:) x4(:)];
abcde = [ones(numel(y),1),log(x)]\log(y);
abcde(1) = exp(abcde(1));
your function
yourfun = @(x,a)a(1)*prod(bsxfun(@power,x,reshape(a(2:end),1,[])),2);
0 Comments
More Answers (0)
See Also
Categories
Find more on Interpolation 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!