12.07.2015 Views

What Is Optimization Toolbox?

What Is Optimization Toolbox?

What Is Optimization Toolbox?

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2 TutorialNonlinear Least-Squares with Full Jacobian SparsityPatternThe large-scale methods in lsqnonlin, lsqcurvefit, andfsolve can be usedwith small- to medium-scale problems without computing the Jacobian in funor providing the Jacobiansparsitypattern.(Thisexamplealsoappliestothecase of using fmincon or fminunc without computing the Hessian or supplyingthe Hessian sparsity pattern.) How small is small- to medium-scale? Noabsolute answer is available, as it depends on the amount of virtual memoryavailable in yourcomputersystemconfiguration.Suppose your problem has m equations and n unknowns. If the commandJ = sparse(ones(m,n)) causes an Out of memory error on your machine,then this is certainly too large a problem. If it does not result in an error,the problem might still be too large, but you can only find out by running itand seeing if MATLABisabletorunwithintheamountofvirtualmemoryavailable on yoursystem.Let’s say you have a small problem with 10 equations and 2 unknowns, suchas finding x that minimizesstarting at the point x = [0.3, 0.4].Because lsqnonlin assumes that the sum of squares is not explicitly formedin the user function, the function passed to lsqnonlin should instead computethe vector valued functionfor(that is,F should have 10 components).Step 1: Write an M-file myfun.m that computes the objectivefunction values.function F = myfun(x)k = 1:10;2-50

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!