The function nlinfit() from the Statistics Toolbox will do this.
Here is a simple example of the use of the function:
x=(0:1:10)';
y = 5 + 3*x + 7*x.^2;
y = y + 2*randn((size(x)));
f = @(F,x) F(1) + F(2).*x + F(3).*x.^2;
F_fitted = nlinfit(x,y,f,[1 1 1]);
disp(['F = ',num2str(F_fitted)])
figure(1)
plot(x,y,'*',x,f(F_fitted,x),'g');
legend('data','nonlinear fit')
Note that I am not actually using nonlinear fitting parameters here, but I hope the idea is clear enough.
Best Answer