12.07.2015 Views

What Is Optimization Toolbox?

What Is Optimization Toolbox?

What Is Optimization Toolbox?

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2 Tutorialx = fminbnd(fh, 3, 4)You can create anonymous functions of more than one argument. For example,to use lsqcurvefit, you first need a function that takes two input arguments,x and xdata,fh = @(x,xdata)sin(x).*xdata +(x.^2).*cos(xdata);x = pi; xdata = pi*[4;2;3];fh(x, xdata)ans =9.86969.8696-9.8696and you then call lsqcurvefit.% Assume ydata existsx = lsqcurvefit(fh,x,xdata,ydata)Other Examples That Use this TechniqueA Matrix Equationx = fsolve(@(x)x*x*x-[1,2;3,4],ones(2,2))A Nonlinear Least-Squares Problemx = lsqnonlin(@(x)x*x-[3 5;9 10],eye(2,2))Passing Additional ArgumentsAn example using fgoalattain where the function has additional argumentsto pass to the optimization routine. For example, if the function to beminimized has additional arguments A, B, andC,A = [-0.5 0 0; 0 -2 10; 0 1 -2];B = [1 0; -2 2; 0 1];C = [1 0 0; 0 0 1];2-96

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

Saved successfully!

Ooh no, something went wrong!