MATLAB: Custom fitting / additional boudary conditions on parameters

curve fittingcustom

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];

Best Answer

Use fmincon to be able to account for your constraints.
Best wishes
Torsten.