# Limit subfunctions values in least square curve fitting

1 view (last 30 days)
Zine on 13 Mar 2014
Commented: Matt J on 13 Mar 2014
Hi all,
I have a function like y-theoretical=A*x+(exp(B/C)/ln(Dx)).x and y-experimental are supplied from experiment; where A=f(x,a,b,c,d); B=f(x,a,b,c,d); C=f(x,a,b,c,d); D=f(x,a,b,c,d), I have the upper and lower limits of a,b,c,d that will result to A,B,C,D and then to curve fitting of y-theoretical to y-experimental ,
my question is how to limit the values of A,B,C,D to do not be lower or exceed some specific values like 0<A<0.85; without limiting the lb or ub of a,b,c,d

Matt J on 13 Mar 2014
You will have to use an optimization algorithm which supports nonlinear inequality constraints, e.g., FMINCON.
Or, by analyzing f(), you must find linear or bounds constraints on a,b,c,d that imply desired bounds on A,B,C,D
##### 2 CommentsShow 1 older commentHide 1 older comment
Matt J on 13 Mar 2014
your nonlcon function should look like
function [cineq,ceq]=nonlcon(x)
...computations...
upper=[A,B,C,D]-[A_ub,B_ub,C_ub,D_ub];
lower=[A_lb,B_lb,C_lb,D_lb] -[A,B,C,D];
ceq=[];
cineq=[lower,upper];

### Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!