custom fitting / additional boudary conditions on parameters
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Torsten
2015-2-6
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.
采纳的回答
Torsten
2015-2-5
Use fmincon to be able to account for your constraints.
Best wishes
Torsten.
3 个评论
Torsten
2015-2-5
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!