1

I have a very odd error with cvx/matlab.

I'd like to solve SDP problem to get dual variable. Here is my code.

addpath(<cvx_directory>)
cvx_setup

cvx_begin
variable r(n);
variable R(n,n) symmetric;
dual variable alpha;
dual variable pi;
minimize(trace(A0*R))
pi: trace(A1*R) <=0;
alpha: r== diag(R);
[R r;r' 1] == semidefinite(n+1);
cvx_end

A0,A1 are given. When I write the above code in the script form it does not return any error. But I should pass the value of n (the size of variable), thus I edited the above code in the function form (Add function [output] = sdp(n) at the first line) and then it returns error :

Undefined operator ':' for input arguments of type 'cvx'.
Error in  pi: trace(A1*R) <=0;

If I move dual variable pi to right of the line (as like trace(A1*R)<=0 : pi)

then it returns the other error :

Too many output arguments
Error in alpha: r== diag(R);

What happen?

// I added cvx_setup in the code to make sure that cvx is installed

Jaeyoon Yoo
  • 171
  • 1
  • 2
  • 9

0 Answers0