MATLAB: Curve fit for multiple variables

curve fitmultiple variable inputs

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.

Best Answer

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);
Please read about use '\'