custom fitting / additional boudary conditions on parameters
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Onufry Torbus
el 5 de Feb. de 2015
Comentada: Onufry Torbus
el 7 de Feb. de 2015
Hi there,
I am working on a custom curve fitting. It is a set of exponential functions, see below. My problem is that I have to apply constraints on paramateres g1, g2 and g3, in a way that: g1 + g2 + g3 = 1.
Can you help me out? /OT
ft = fittype(['E0*((1-g1-g2-g3)*t+g1*tau1*(1-exp(-t/tau1))+g2*tau2*(1-exp(-t/tau2))+g3*tau3*(1-exp(-t/tau3)))'],'independent', 't', 'dependent', 'y' );
opts = fitoptions( ft );
opts.Display = 'Off';
opts.Lower = [0 0 0 0 0 0 0];
opts.StartPoint = [0 0 0 0 1 10 100];
opts.Upper = [Inf 1 1 1 Inf Inf Inf];
2 comentarios
Torsten
el 6 de Feb. de 2015
I just looked at the type of fit you defined in your question.
If you want f1+f2+f3=1 in the above fittype, the factor in front of t, namely 1-f1-f2-f3, becomes zero. Is this really what you intend ?
Best wishes
Torsten.
Respuesta aceptada
Torsten
el 5 de Feb. de 2015
Use fmincon to be able to account for your constraints.
Best wishes
Torsten.
3 comentarios
Torsten
el 5 de Feb. de 2015
As objective function, you provide
sum_{i=1}^{n} (y_i-f(t_i))^2
with
f(t)=A*((1-f1-f2-f3)*t+g1*t1*(1-exp(-t/t1))+g2*tau2*(1-exp(-t/t2))+g3*t3*(1-exp(-t/t3)))
and as constraints your lower and upper bounds for the parameters to be fitted together with the additional constraints from above.
Read the documentation of fmincon on how to set up the call:
Best wishes
Torsten.
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!