Returns the starting point.
[n,m,x]=uncprb_getinitpt(nprob) [n,m,x]=uncprb_getinitpt(nprob,fact)
the problem number
a 1 x 1 matrix of doubles, multiplier for the coordinate of x0 (default = 1)
the number of variables, i.e. the size of x
the number of functions, i.e. the size of fvec
a n x 1 matrix of doubles, the (multiplied) starting point
This function generates the starting points for each problem by calling the function initf, which sets m, n and the starting point xo for the number of problem given to it. If xo is the standard starting point, then x will contain fact*xo, except if xo is the zero vector and fact is not unity, then all the components of x will be set to fact.
// Get starting data for Rosenbrock's test case // n=2, m=2, x=[-1.2,1]' nprob = 1 [n,m,x]=uncprb_getinitpt(nprob) // Get starting data for Rosenbrock's test case // Multiplies x0 by 3 [n,m,x]=uncprb_getinitpt(nprob,3) // Get a sequence of starting points, // increasingly away from the usual one. nprob = 1 alpha = 5 ntries = 10 fact = 1 for k = 1 : ntries [n,m,x0]=uncprb_getinitpt(nprob,fact); fact = alpha * fact; disp([k x0']) end // Get a sequence of starting points, // randomly in the neighbourhood of the usual one. nprob = 1 ntries = 10 len = 2 [n,m,x0]=uncprb_getinitpt(nprob); plot ( x0(1) , x0(2) , "ro" ) for k = 1 : ntries [n,m,x0]=uncprb_getinitpt(nprob); x0 = x0 + len * (2*rand(n,1)-1); disp([k x0']) plot ( x0(1) , x0(2) , "b*" ) end | ![]() | ![]() |