Prev: cell challenge
Next: Matlab Error Handles
From: Eric Anterrieu on 23 Jul 2010 05:22 I have data vectors x and y and I would like to minimize a function f(p)=||y-s(p,x)||² with respect to parameters vector p subject to a constraint (y-s(p,x)) < d on each data point (d is a vector the same size as x and y). The problem is the following one: fmincon allows linear/nonlinear constraints but with vectors the same size the variable on which the optimization is performed, here p. The size of my constraint is not the same size as p, it has the same size as x and y. Typically, I would like to find a curve which depends on 10 parameters and passing through 10000 points with the constraint to control the individual distances between the curve and each data points. Any idea?
From: Nic Roberts on 23 Jul 2010 07:00 Hi Have you tried lsqcurvefit() ? Nic "Eric Anterrieu" <eric.anterrieu(a)ast.obs-mip.fr> wrote in message <i2bmvt$6nk$1(a)fred.mathworks.com>... > I have data vectors x and y and I would like to minimize a function f(p)=||y-s(p,x)||² with respect to parameters vector p subject to a constraint (y-s(p,x)) < d on each data point (d is a vector the same size as x and y). > The problem is the following one: fmincon allows linear/nonlinear constraints but with vectors the same size the variable on which the optimization is performed, here p. > The size of my constraint is not the same size as p, it has the same size as x and y. > Typically, I would like to find a curve which depends on 10 parameters and passing through 10000 points with the constraint to control the individual distances between the curve and each data points. > Any idea?
From: Eric Anterrieu on 23 Jul 2010 08:20 lsqcurvefit does not allow any constraint, only least square fitting. "Nic Roberts" <dingtheking(a)googlemail.com> wrote in message <i2bso7$5ns$1(a)fred.mathworks.com>... > Hi > > Have you tried lsqcurvefit() ? > > Nic > > "Eric Anterrieu" <eric.anterrieu(a)ast.obs-mip.fr> wrote in message <i2bmvt$6nk$1(a)fred.mathworks.com>... > > I have data vectors x and y and I would like to minimize a function f(p)=||y-s(p,x)||² with respect to parameters vector p subject to a constraint (y-s(p,x)) < d on each data point (d is a vector the same size as x and y). > > The problem is the following one: fmincon allows linear/nonlinear constraints but with vectors the same size the variable on which the optimization is performed, here p. > > The size of my constraint is not the same size as p, it has the same size as x and y. > > Typically, I would like to find a curve which depends on 10 parameters and passing through 10000 points with the constraint to control the individual distances between the curve and each data points. > > Any idea?
From: Torsten Hennig on 23 Jul 2010 04:46 > I have data vectors x and y and I would like to > minimize a function f(p)=||y-s(p,x)||² with respect > to parameters vector p subject to a constraint > (y-s(p,x)) < d on each data point (d is a vector the > same size as x and y). > The problem is the following one: fmincon allows > linear/nonlinear constraints but with vectors the > same size the variable on which the optimization is > performed, here p. > The size of my constraint is not the same size as p, > it has the same size as x and y. > Typically, I would like to find a curve which depends > on 10 parameters and passing through 10000 points > with the constraint to control the individual > distances between the curve and each data points. > Any idea? You should not fix an allowed error between model and data points in advance and put it into constraints because you don't know in advance whether the problem posed in this way will even be feasible. Better take weights w_i > 0 and minimize the weighted squared error sum_i w_i*(y_i-s(p,x_i))^2 with w_i "small" if larger errors are allowed in x_i and w_i "big" if only small errors in x_i are allowed. Best wishes Torsten.
From: Eric Anterrieu on 23 Jul 2010 09:06
This what I am doing actually, but it is not satistying! Indeed it is well known that with a least square approach even few wrong points may have a strong influence on the result because it is a global approach and here it is amplified because data have the same variance (so same weights) including the wrong points (they are wrong, not noisier). This problem belong to the class of problem known as "curve fitting in presence of obstacles", and trust me it is not easy to solve! If you explain me how to post an image on this forum, I can show you an exemple. Regards, Eric Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <1241922333.42334.1279889225290.JavaMail.root(a)gallium.mathforum.org>... > You should not fix an allowed error between model > and data points in advance and put it into constraints > because you don't know in advance whether the problem > posed in this way will even be feasible. > Better take weights w_i > 0 and minimize the weighted > squared error > sum_i w_i*(y_i-s(p,x_i))^2 > with w_i "small" if larger errors are allowed in x_i > and w_i "big" if only small errors in x_i are allowed. > > Best wishes > Torsten. |