Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: multiple variable exponential regression
Posted:
Nov 6, 2013 12:30 PM


> I was using other nonlinear regression methods but was getting an > imaginary solution (a+ib) form ... > modelfun = @(b, x)((100  15*(x(2, :).^b(1))))  (40*((x(3, :).^b(2))))  > (15*((x(4, :).^b(3)))) x = TestData; > y = x(1, :); > > [beta, R, J, CovB, MSE] = nlinfit(x, y, modelfun, beta0, opts);
One thing I see here is that you have not removed the y column from x, so x(1,:) will refer to the same thing as y. In general, if you have any negative x values this could yield imaginary results as the nlinfit function manipulates the b values. You could use abs() in your modelfun to avoid that, but I don't know if that makes sense in your application.
 Tom



