Hello everyone, I have written a local function in matlab and called it in cvx (my function name is Re and called it in cvx and its arguments: p and p0 are vectors and N is scalar).

I’ve written my code below, my error is “Conversion to double from cvx is not possible” can you help me eliminate it?

Thank you.

cvx_begin

variable x(n);

minimize (norm(p-Re(p,p0+x,N)));

subject to

x(1) == 0.5;

x(2) == 0.5;

0 < x(3)^2+x(4)^2 <=1;

0 < x(5)^2+x(6)^2 <=1;

0 < x(7)^2+x(8)^2 <=1;

0 < x(9)^2+x(10)^2 <=1;

cvx_end