Optimization Problem definition the function
Mostra commenti meno recenti
Hi everyone,
I am trying to define a nonlinear optimization function with 3 unknown variables which I need to optimize.
The optimization function is very large and needs a for loop to be defined, furthermore there are no contraint.
But I am having difficulty defining the function within the for-loop, what I currently have is:
syms x1
syms x2
syms x3
table = readtable('data.csv');
array = table2array(table);
x = [x1,x2,x3]';
for i=1:100
Afun = @(x)((x(1)*array(i,1)-x(2)*array(i,2)+x(3)*array(i,3))^2);
if i==1
FUN = Afun;
else
FUN = FUN + Afun;
end
end
But I get an error where the functions do not want to add, generally I am not sure if I am approaching this type of problem correctly with this method.
Any thought? Thanks!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!