Multi-parametric fit

27 visualizaciones (últimos 30 días)
Miguel Ángel
Miguel Ángel el 3 de Abr. de 2012
Comentada: Ajay Balan Muthuramesh el 15 de En. de 2014
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.

Respuesta aceptada

the cyclist
the cyclist el 3 de Abr. de 2012
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')

Más respuestas (2)

Miguel Ángel
Miguel Ángel el 4 de Abr. de 2012
Thaks for your answer! The nlinfit is a function that I didn’t know that’s going to save me lot of computational writing. But when I reread my message again, I noticed that I didn’t get myself across well, I am sorry.
What I want is the expression of the multi-parametric fit; which I have to “guess” with my parametric data. For example, X can be like
X=A*log(B)^C+D/2, or
X=A^3/B+C*exp(D), or X=B*D…that is what I want to know.
To hit the mark we can use dimensional analysis, but it has some limitations. We can do:
X=(A^a)*(B^b)*(C^c)*(D^d)
and fitting with experimental data, finding the coefficients a,b,c,d that minimize the error (an iterative process where we can use nlinfit with its least-squares, or Nelder–Mead Method,f.e). But, as you see, limitations are huge. What I want to know is if there is a toolbox that links the behave of the variables, trying and iterating with different function to reach the best expression for X.
I think I am asking too much, and maybe there’s no toolbox that does exactly that…but if there’s any m file you know that would help me to get the most out of calculating whit matlab in this situation (as nlinfit does) I would be very pleased.
Sorry again for the mistakes of the previous post and thanks for your answers
  2 comentarios
the cyclist
the cyclist el 4 de Abr. de 2012
Off the top of my head, I don't think so. There are some interactive tools like "disttool" and "dfittool", but they are all going to use the more common distributions, so I am not sure what help they might be.
That being said, I suggest you ask your new question separately, rather than burying it as an "answer" in this thread. It is not likely to get much traffic here, especially with an accepted answer already. You might also consider searching the File Exchange.
Miguel Ángel
Miguel Ángel el 4 de Abr. de 2012
I am a noob on this, so I thanks a lot all your advices!

Iniciar sesión para comentar.


Miguel Ángel
Miguel Ángel el 11 de Abr. de 2012
Today, after days of work, I've noticed that nlinfit() is the function that I need to solve my problem. Sorry for not understanding well the answer. Thanks, the cyclist!
  1 comentario
Ajay Balan Muthuramesh
Ajay Balan Muthuramesh el 15 de En. de 2014
Miguel - Even I am facing the same problem that you had. How do you use the nlinfit() to guess the function between A,B,C,D. I basically have a data set with three variables A,B,C and the result is D=f(A,B,C) . I want to predict that function. Kindly help on this

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by