Error Using Abs matlab function: check for incorrect argument data type or missing argument in call to function 'abs'

조회 수: 13 (최근 30일)
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?

채택된 답변

Walter Roberson
Walter Roberson 2022년 9월 26일
abs is not supported for optimization variables. However, sqrt and squaring are supported.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by