MATLAB: Multi-parametric fit

fitparametric

Hi everyone! My question is as follows:
I have several experimental data, X. X is dependent of 4 different independent variables; X=f(A,B,C,D), which are experimental data too. How can I fit them?. For example, if I had only X and A, maybe the relation would be like X=A^3 (easily to do with cftool). But what I want to get is a multi-parametric fit like these (it doesn’t have to be linear): X=A*log(B)^C+D/2.
Is that possible to be done? Is there any toolbox that may help me? I thought about a procedure, but it’s pretty biased. Any ideas are welcome. Thanks in advance.

Best Answer

The nlinfit() function in the Statistics Toolbox does this type of fit. Here is a simple example that I wrote to help another poster:
% Here is an example of using nlinfit(). For simplicity, none of
% of the fitted parameters are actually nonlinear!
% Define the data to be fit
x=(0:1:10)'; % Explanatory variable
y = 5 + 3*x + 7*x.^2; % Response variable (if response were perfect)
y = y + 2*randn((size(x)));% Add some noise to response variable
% Define function that will be used to fit data
% (F is a vector of fitting parameters)
f = @(F,x) F(1) + F(2).*x + F(3).*x.^2;
F_fitted = nlinfit(x,y,f,[1 1 1]);
% Display fitted coefficients
disp(['F = ',num2str(F_fitted)])
% Plot the data and fit
figure(1)
plot(x,y,'*',x,f(F_fitted,x),'g');
legend('data','fit')