Prev: cell challenge
Next: Matlab Error Handles
From: Eric Anterrieu on 23 Jul 2010 10:20 "Yi Cao" <y.cao(a)cranfield.ac.uk> wrote in message <i2c7m8$ba5$1(a)fred.mathworks.com>... > "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? > > Your understanding on constraint size is wrong. This problem can be solved using fmincon. You need to provide a cost function, which is f(p) and a constraint function, which returns an empty equality constrat and a residual vector of the inequality constraints y-d-s(p,x) (<0). Yes but both function should accept the same arguments and the constraint one should return as many inequalitie as unknowns. Here the unknowns are the p parameters, whereas I want to impose as inequalities as number of data.
From: Matt J on 23 Jul 2010 10:38
"Eric Anterrieu" <eric.anterrieu(a)ast.obs-mip.fr> wrote in message <i2c8ek$30o$1(a)fred.mathworks.com>... > > Your understanding on constraint size is wrong. This problem can be solved using fmincon. You need to provide a cost function, which is f(p) and a constraint function, which returns an empty equality constrat and a residual vector of the inequality constraints y-d-s(p,x) (<0). > > Yes but both function should accept the same arguments ============= They should both be functions of p, but you can pass additional fixed-parameter arguments using anonymous or nested functions, e.g. cineq=@(p) y-d-s(p,x) and the constraint one should return as many inequalitie as unknowns. Here the unknowns are the p parameters, whereas I want to impose as inequalities as number of data. ========================= No, there is no such limitation. Why do you think so? |