:: O-Matrix ::
 > Overview > Examples > Performance > Analysis Functions > Data Visualization > The O-Matrix Language > Data Manipulation/IO > Application Development > Using Matlab m-files

 NLSQBOX.OMS Script File: ```# Description: # Solves nonlinear least squares with box constraint. # clear # nonlinear function function f(x) begin return {exp(x(1)) - exp(1.), exp(x(2)) - exp(2.)} end # # level of tracing inside of nlsqbox level = 0 # maximum number of iterations maxit = 20 # initial x value xini = {0., 0.} # lower limit for x xlow = { - 1., - 1.} # upper limit for x xup = { + 1., + 1.} # store all the iterates x = nlsqbox(function f, xini, xlow, xup, maxit, level) # number of iterations nitr = coldim(x) - 1 # minimizer subject to constraints argmin = x.col(nitr + 1) # print "minimizing the sum of the squares of the components of" print "{exp(x(1)) - exp(1.), exp(x(2) - exp(2.)}" print "subject to", xlow(1), "<=", "x(1)", "<=", xup(1) print " ", xlow(2), "<=", "x(2)", "<=", xup(2) print "xini' =", xini' print "argmin' =", argmin' print "nitr =", nitr ``` Output: ``` minimizing the sum of the squares of the components of {exp(x(1)) - exp(1.), exp(x(2) - exp(2.)} subject to -1 <= x(1) <= 1 -1 <= x(2) <= 1 xini' = [ 0 , 0 ] argmin' = [ 1 , 1 ] nitr = 2 ```
 Company |  Products |  Showcase |  Support |  Ordering Copyright© 1994-2009 Harmonic Software Inc. - All rights reserved.