Error Using Abs matlab function: check for incorrect argument data type or missing argument in call to function 'abs'
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hossein alizadeh
el 26 de Sept. de 2022
Comentada: hossein alizadeh
el 26 de Sept. de 2022
I'm using matlab optimizer to solve an optimization problem (with this objective function via genetic algorithm):
camxy = @(R,Dz)norm( abs( 2*R * [cos(Dz.'*k*sin(pi/180*Theta'))])'- g);
where g is a given function and k,pi are known constants where Theta is a column vector.
After creation optimization variables using "optimvar":
R = optimvar("R",1,30,"LowerBound",0,"UpperBound",1);
Dz = optimvar("Dz",1,30,"LowerBound",0,"UpperBound",20);
It faces the error below and the object function of optimization problem can not be created:
check for incorrect argument data type or missing argument in call to function 'abs'
how can I fix it?
0 comentarios
Respuesta aceptada
Walter Roberson
el 26 de Sept. de 2022
abs is not supported for optimization variables. However, sqrt and squaring are supported.
Más respuestas (0)
Ver también
Categorías
Más información sobre Problem-Based Optimization Setup en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!