For Programmers: Free Programming Magazines  


Home > Archive > Matlab > August 2007 > Help: Positive values for Objective Function in lsqcurvefit









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help: Positive values for Objective Function in lsqcurvefit
Mauricio Argote-Cortes

2007-08-30, 8:59 pm

Hi all,

How can I restrict (or force) the objective function in
lsqcurvefit to evaluate the coefficients for which it is
positive?

I wonder if I could insert a conditional form into my M-File
for the Objective Function, but if that's possible I am not
sure how... Are there examples of these kind of conditionals
for the objective function somewhere?

I'm running lsqcurvefit to fit the M-file function:

Y(j) = a(1)*X(j,1) - k1*X(j,2).^a(2) - a(3)*k2*X(j,3).^k3

where a(i) are the coefficients for which the lower bounds
are [0 0 0]. X(j,1), X(j,2), X(j,3) come from a set of j
measurements, and Y(j) are also measurements related to each
X(j,m). kl are known constants...

My Ydata values are positive, and depending what initial
estimates for a(i) I give, the objective function values are
negative (which are unreal for my experiment). So, I want to
make this function to evaluate the coefficients a(i) for
which it takes positive values only.

Thanks,

Mauricio
John D'Errico

2007-08-30, 8:59 pm

"Mauricio Argote-Cortes" <argote.nospamplease@yorku.ca> wrote in
message <fb7ccc$7gq$1@fred.mathworks.com>...
> Hi all,
>
> How can I restrict (or force) the objective function in
> lsqcurvefit to evaluate the coefficients for which it is
> positive?
>
> I wonder if I could insert a conditional form into my M-File
> for the Objective Function, but if that's possible I am not
> sure how... Are there examples of these kind of conditionals
> for the objective function somewhere?
>
> I'm running lsqcurvefit to fit the M-file function:
>
> Y(j) = a(1)*X(j,1) - k1*X(j,2).^a(2) - a(3)*k2*X(j,3).^k3
>
> where a(i) are the coefficients for which the lower bounds
> are [0 0 0]. X(j,1), X(j,2), X(j,3) come from a set of j
> measurements, and Y(j) are also measurements related to each
> X(j,m). kl are known constants...
>
> My Ydata values are positive, and depending what initial
> estimates for a(i) I give, the objective function values are
> negative (which are unreal for my experiment). So, I want to
> make this function to evaluate the coefficients a(i) for
> which it takes positive values only.


You cannot enforce constraints of this form in
the context of lsqcurvefit.

You might choose to use fmincon, defining a list
of nonlinear constraints at a series of points. Then
constrain the function at each point to be positive.
This will be a necessary constraint for positivity,
although not sufficient. Its probably the best that
you can do easily though.

John
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com