I have the code to find matrix w optimal:

"prompt = 'How many relays N do you want? ';

n = input(prompt) %numbers of relay N

snrthreshdb=10;

snrthesh=10^(snrthreshdb/10);

phi2=1; %0db

Psdb=14;%14db

Ps=10^(Psdb/10);

In=eye(n,n)%Identity matrix nxn

fRn=zeros(1,n)

gRn=zeros(1,n);

hRn=zeros(1,n);

cEn=zeros(1,n);

phifc=zeros(1,n);

phigc=zeros(1,n);

phifh=zeros(1,n);for count=1:n

fRn(1,count)=normrnd(0,1)+normrnd(0,1)*i %row vector

gRn(1,count)=normrnd(0,1)+normrnd(0,1)*i %row vector

hRn(1,count)=normrnd(0,1)+normrnd(0,1)*i %row vector

cEn(1,count)=normrnd(0,1)+normrnd(0,1)*i %row vector

phifc(1,count)=fRn(1,count)*cEn(1,count);

phigc(1,count)=gRn(1,count)*cEn(1,count);

phifh(1,count)=fRn(1,count)*hRn(1,count)

endRff=diag(fRn);

Rgg=diag(gRn);

Rhh=diag(hRn);

Rfh=phifh*ctranspose(phifh);for Psum=10:5:40

PRi=Psum/(n+1);

Pn=Psum/(n+1);

Q=Ps * Rff+Pn * Rgg+phi2*In

```
cvx_begin
variable w(n,n) complex
minimize (w')*Q*w %.............................................................error position
(Ps*(w')*Rfh*w)/(phi2*(1+(w')*Rhh*w))>=10;
for count=1:n
w(count,count)*(w(count,count)')*Q(1,1)<=PRi;
end
cvx_end
```

`end"`

After running the program, I received error message:

"Error using minimize

Too many output arguments.

Error in desRsvsPs (line 40)

minimize (w’)*Q*w"

Can someone help me solve the problem?