Minimisation of object function having 2d array as variables.
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Akanistha Banerjee
am 19 Jan. 2020
Beantwortet: Thiago Henrique Gomes Lobato
am 19 Jan. 2020
I want to minimise the following function using the optimtool.

Can anyone help me with its code. I am having problem having to use 2d array as the variables.
0 Kommentare
Antworten (1)
Thiago Henrique Gomes Lobato
am 19 Jan. 2020
Any 2D array can be represented with a vector, which is the normal input to optimization functions, so all you need to do is write your function to take a vector as input and them convert it to a matrix. A minimalist example:
x = randn(7); % Original matrix
opt = fun(x(:)); % Convert matrix to a vector for function
function opt = fun(x)
x = reshape(x,7,7) % Convert vector to matrix
%... your functio
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!