A possible error

In CVX, I declared ‘beta’ with two arguments (i.e., variable beta(nUsers,nUsers))
to be an optimization without recalling that it is a Matlab built-in (in fact well-known)
function. Part of my Matlab code is given below

cvx_begin sdp
    variable beta(nUsers,nUsers)
    ...
    subject to
    ...
    for jUser = 1:nUsers
        if(jUser ~= iUser)
            F = 0;
            for iEllipsoid=1:nEllipsoids
                F = F +mylambda(iEllipsoid,jUser,iUser)*...
                    Ellipsoids(:,:,iUser,usercellindex(jUser),iEllipsoid);
            end
            % an LMI
            [beta(jUser,iUser)-sum(mylambda(:,jUser,iUser))  zeros(1,nTx)      
                        -channel(:,:,iUser,usercellindex(jUser))*beamformer(:,jUser);
             zeros(nTx,1)   F   beamformer(:,jUser);
            -beamformer(:,jUser)'*channel(:,:,iUser,usercellindex(jUser))'  
               beamformer(:,jUser)'   1] >= 0;
        end
     end
     ....
     noisevariance + sum(beta(otherusers,iUser)) <= mymu(iUser);
cvx_end

When I go into the cvx environment, it appears that CVX already overwrites the function
beta and I got the results

The problem is that I just change ‘beta’ to ‘mybeta’ and actually obtain different
(better) results. Can you please tell me what the potential problem is? I guess it could be
a matter of overwriting in Matlab.

It looks like you have uncovered a bug in CVX—or, at least, an unanticipated interaction between CVX and the way that MATLAB parses programs.

I do know that when MATLAB is doing it’s pre-processing, it does not know tha you have intended beta to be a variable—even though you have declared it to be the case in your variable command. That’s because MATLAB doesn’t actually interpret the variable command itself; it just notes that it needs to call the variable.m file in CVX and pass the rest of the line as its arguments. Your experience suggests, then, that if the name of a variable is already the name of a function, the CVX is not able to tell MATLAB to stop referring to the function, even though it tries to!

I’m sorry that you encountered this difficulty, and I will investigate how to better handle this case. In the meanwhile, of course, the solution is to ensure that your variable names do not coincide with the names of MATLAB functions.

Dear mcg: Thank you very much for your answer.