How to minimise a function with three input arguments in least squared sense in MATLAB ?

I was having a look at the x = lsqnonlin(fun,x0,lb,ub) command in Matlab. But as the syntax shows, the function 'fun' has only one variable 'x' whose initial value is x0 and optimised lb < x < ub. But what If I have a function with three input variables. All the three variables have upper and lower limits respectively. And my objective is to minimise the function with optimal values of these three variables within the specified range. Eg: t = function(x,y,z) I would like to find optimal values of x,y, and z such that value of t is minimised.

Antworten (1)

Torsten
Torsten am 20 Mär. 2015
x0, lb and ub are not necessarily scalars, but can also be vectors of length 3 ...
Best wishes
Torsten.

2 Kommentare

Thanks a lot for the clarity. But My problem is slightly different. I have a symbolic function in place of the function 'fun' in the lsqnonlin syntax. As per the example provided. it says " * Because lsqnonlin assumes that the sum of squares is not explicitly formed in the user-defined function, the function passed to lsqnonlin should instead compute the vector-valued function * " which means the output of the function should be a vector with n components. But in my case I have a symbolic function whose size is 1 by 1 .
Then pass a new function to lsqnonlin in which you call your symbolic function n times to compute the vector (f1,f2,...,fn).
Best wishes
Torsten.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 20 Mär. 2015

Kommentiert:

am 24 Mär. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by