Cannot perform the operation: {real affine} ./ {real affine}?!

(esmail) #1

Hi.I writting my optimization problem in cvx and running that but i had a error .I attached the program and thats error.please if it is possible help me…

function F=examin()
if nargin==0
a=[ 0.0181 -0.0041 0.0040 0.0373 0.0580 0.0009 0.0250 -0.0009 0.0205 0.0302
0.0290 0.0260 0.0260 -0.0234 0.0250 -0.0136 -0.0311 -0.0451 0.0576 -0.0288];

    variables v(2) m s;
    f=@(x) ((1/6)*(1-(1-(x)^2)^3))*(abs(x)<=1)+(1/6)*(abs(x)>=1);
    for j=1:9
    g=(1/10)*(f(( ( (v(1)*a(1,j)) + (v(2) * a(2,j)) )  - m)/s));
    subject to


And the following statement is my program error…!!!

Warning: A non-empty cvx problem already exists in this scope.
It is being overwritten.

In cvxprob.cvxprob at 28
In cvx_begin at 41
In examin at 11
Error using cvx/times (line 173)
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {real affine}

Error in cvx/rdivide (line 19)
z = times( x, y, ‘./’ );

Error in cvx/mtimes (line 36)
z = feval( oper, x, y );

Error in cvx/mrdivide (line 15)
z = mtimes( x, y, ‘rdivide’ );

Error in examin (line 15)
g=(1/10)*(f(( ( (v(1)*a(1,j)) + (v(2) * a(2,j)) ) - m)/s));

please help me.thank you very much.

(Mark L. Stone) #2

The argument of f, not to mention f itself, and therefore g and h1, are violating CVX’s rules. Try reading Why isn’t CVX accepting my model? READ THIS FIRST! and re-reading the CVX User’s Guide.

(esmail) #3

HI.thank you very much for your help.

(Michael Tarerefa) #4

Hi dear, I’m having this same error messages. How did you rewrite your expression for CVX to accept it?

(Liu Yuanfei) #5

Hi. I have the same error as you. CVX can’t identify my objective function. Have you solved this problem?

(Mark L. Stone) #6

@YuanfeiLiu If you post your complete program and error message(s), perhaps someone can help you. Prior to doing that, please read Why isn’t CVX accepting my model? READ THIS FIRST! and the CVX Users’ Guide

(Liu Yuanfei) #7

Thank you for your help. I will post my complete program and error messages.