How Can fix the problem

Hi All
I need to solve the optimization problem as follows using CVX

minimize (w'*R*w)
st:    w'*v=1
       norm(w)<=delta

where w’ means w hermetion and w is a complex vectro
R and v are complex matrix and vector repectively and delta is a scalar.

I developed the code below:

cvx_begin 
       variable w(M,1)  complex
       minimize  (w'*R_f*w)
          subject to       
               w'*v==1;
               norm(w)<=Delta
          
cvx_end

 OR

cvx_begin 
       variable w(M,1)  complex
       minimize (real((w'*R_f*w)))
          subject to       
               w'*v==1;
               norm(w)<=Delta
          
cvx_end

But this error accur:

Error using * (line 155)
Disciplined convex programming error:
Invalid quadratic form: not real.
Error in BF_MyMain (line 70)
minimize (real((w’R_fw)))

How can I solve the problem? tnx

Is R Hermitian semidefinite?

How Can I check whether R is Hermitian semidefinite or not?

R-R'
eig(R)

K>> R_f-R_f’

ans =

Columns 1 through 8

 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0
 0     0     0     0     0     0     0     0

Column 9

 0
 0
 0
 0
 0
 0
 0
 0
 0

eig®= -0.0000
-0.0000
-0.0000
-0.0000
0.0000
0.0000
0.0000
0.0000
540.2161

R-R’ is All-zero Matrix.
and eigenvalues of R has only o
ne non-zero elemnet

It appears some eigenvalues are slightly negative (perhaps roundoff level). Maybe add a small multiple (a little larger than abs(min(eig(R)))) of the identity matrix to R to make it numerically Hemitian semidefinite.

There need to be no negative eigenvalues (as numerically evaluated (by CVX).

the first eigenvalue is d(1)

ans =

-5.2460e-14

the second one is
-1.4679e-14

the third one is
-1.0399e-14

and the 4th one is
ans =

-8.0278e-16

the 5th one is
2.0003e-15

and …

Try adding 1e-8*eye(9) to R` Your current R has roundoiff level deviation from being hermitian semidefinite. That is enough to generate an error in CVX.

After adding 1e-8*eye(9) to R , eigenvalues of R is
d=diag(Gamma)

d =

0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000

524.7650

Use that.

Anyhow, you should use long format, not short format to examine the eigenvalues.

Thnaks alot.
I run CVX again with the new R_f , I still have the same error;

Error using * (line 155)
Disciplined convex programming error:
Invalid quadratic form: not real.

Error in BF_MyMain (line 70)
minimize (w’* R_f *w)

Please show your code, with all input data. Did you use the adjusted R_f?

yes I adiusted R_f .

INR  = 20; %dB Interference -to-noise ratio for interferers.
a1 = sqrt(10^(INR/10)*NoisPower);      % Amplitude of interefrer signal 1
a2 = sqrt(10^(INR/10)*NoisPower);      % Amplitude of interefrer signal 2

%**** Making Xtild_t for snapshot t
f_thetas = pi * sind(Theta_s);
f_theta1 = pi * sind(Theta_1);
f_theta2 = pi * sind(Theta_2);
X1tild_t = a1*(1-exp(1j*(f_theta1-f_thetas))).*A(1:M,1)+ a2*(1-exp(1j*(f_theta2-f_thetas))).*A(1:M,2)...
    +(NoiseAmp*randn+1j*NoiseAmp*randn)*(1-exp(1j*(f_theta1-f_thetas))).*A(1:M,1) + (NoiseAmp*randn+1j*NoiseAmp*randn)*(1-exp(1j*(f_theta2-f_thetas))).*A(1:M,2);


% Cancellation Matrix for one snapshot
Ft = X1tild_t;

% F = [Ft1, Ft2, Ft3, ..., FtK], K is the number of snapshots.

% ****** Making Cancellation Covariance Matrix R_f = Ft.*Ft'
R_f = Ft*Ft';
R_f= R_f +1e-8*eye(9);
% ****  Making Pre-defined gain direction vector V
V = exp(1i * pi * (0:(M-1))' * sind(Theta_s));


%% ******** Solving Optimization Problem *************

cvx_begin 
       variable w(M,1)  complex
       minimize (w'* R_f *w)
          subject to       
               real(w'*V)==1;
               norm(w)<=Delta
          
cvx_end

Here is the complet code

N              = 10;                   % Number of Antenna Elements.
M              = N-1;                  % Degre of Freedom.
Theta_s        = 0;                    % Desired Sig. Direction of Arrival.
Theta_1        = -10;                  % Direction of Arrival for Jammer 1.
Theta_2        = 10;                   % Direction of Arrival for Jammer 2.
Delta          = 0.2267;               % Positive Cons. In Optimization Problem (9). Delta>= (1/N)
K              = 20;                   % Number of Snapshots.
Ndb            = -15;                  % Noise Power.

%initialization
src_theta  = [0,30];
Num_of_Src = length(src_theta);

Theta_interf = [Theta_1, Theta_2];
As     = exp(1i * pi * (0:(N-1))' * sind(Theta_s));          % Steering vector for source.
A      = exp(1i * pi * (0:(N-1))' * sind(Theta_interf));     % Steering vectors for two interferers.

NoisPower = 1;

%*****************************************************
INR  = 20; %dB Interference -to-noise ratio for interferers.
a1 = sqrt(10^(INR/10)*NoisPower);      % Amplitude of interefrer signal 1
a2 = sqrt(10^(INR/10)*NoisPower);      % Amplitude of interefrer signal 2

%**** Making Xtild_t for snapshot t
f_thetas = pi * sind(Theta_s);
f_theta1 = pi * sind(Theta_1);
f_theta2 = pi * sind(Theta_2);
X1tild_t = a1*(1-exp(1j*(f_theta1-f_thetas))).*A(1:M,1)+ a2*(1-exp(1j*(f_theta2-f_thetas))).*A(1:M,2)...
    +(NoiseAmp*randn+1j*NoiseAmp*randn)*(1-exp(1j*(f_theta1-f_thetas))).*A(1:M,1) + (NoiseAmp*randn+1j*NoiseAmp*randn)*(1-exp(1j*(f_theta2-f_thetas))).*A(1:M,2);


% Cancellation Matrix for one snapshot
Ft = X1tild_t;

% F = [Ft1, Ft2, Ft3, ..., FtK], K is the number of snapshots.

% ****** Making Cancellation Covariance Matrix R_f = Ft.*Ft'
R_f = Ft*Ft';
R_f= R_f +1e-8*eye(9);
% ****  Making Pre-defined gain direction vector V
V = exp(1i * pi * (0:(M-1))' * sind(Theta_s));


%% ******** Solving Optimization Problem *************

cvx_begin 
       variable w(M,1)  complex
       minimize (w'* R_f *w)
          subject to       
               real(w'*V)==1;
               norm(w)<=Delta
          
cvx_end

You still haven’t provided ll the input data. Slow down and do things carefully and systematically… What is min(eig(R_f)`just prior to usage in the CVX expression?

min(eig(R_f))

ans =

 9.999957531515826e-09

%% Simulation Parameters
N = 10; % Number of Antenna Elements.
M = N-1; % Degre of Freedom.
Theta_s = 0; % Desired Sig. Direction of Arrival.
Theta_1 = -10; % Direction of Arrival for Jammer 1.
Theta_2 = 10; % Direction of Arrival for Jammer 2.
Delta = 0.2267; % Positive Cons. In Optimization Problem (9). Delta>= (1/N)
K = 20; % Number of Snapshots.
Ndb = -15; % Noise Power.

%initialization
src_theta = [0,30];
Num_of_Src = length(src_theta);

Theta_interf = [Theta_1, Theta_2];
As = exp(1i * pi * (0:(N-1))’ * sind(Theta_s)); % Steering vector for source.
A = exp(1i * pi * (0:(N-1))’ * sind(Theta_interf)); % Steering vectors for two interferers.

NoiseAmp = 10^(Ndb/20); %noise amplitude for complex noise
Whit_noise=1/sqrt(2)(NoiseAmprandn+1jNoiseAmprandn); %noise process generaation
NoisPower = Whit_noise*Whit_noise’;

%*****************************************************
INR = 20; %dB Interference -to-noise ratio for interferers.
a1 = sqrt(10^(INR/10)*NoisPower); % Amplitude of interefrer signal 1
a2 = sqrt(10^(INR/10)*NoisPower); % Amplitude of interefrer signal 2

%**** Making Xtild_t for snapshot t
f_thetas = pi * sind(Theta_s);
f_theta1 = pi * sind(Theta_1);
f_theta2 = pi * sind(Theta_2);
X1tild_t = a1*(1-exp(1j*(f_theta1-f_thetas))).A(1:M,1)+ a2(1-exp(1j*(f_theta2-f_thetas))).A(1:M,2)…
+(NoiseAmp
randn+1jNoiseAmprandn)(1-exp(1j(f_theta1-f_thetas))).A(1:M,1) + (NoiseAmprandn+1jNoiseAmprandn)(1-exp(1j(f_theta2-f_thetas))).*A(1:M,2);

% Cancellation Matrix for one snapshot
Ft = X1tild_t;

% F = [Ft1, Ft2, Ft3, …, FtK], K is the number of snapshots.

% ****** Making Cancellation Covariance Matrix R_f = Ft.Ft’
R_f = Ft
Ft’;
R_f= R_f +1e-8*eye(9);
% **** Making Pre-defined gain direction vector V
V = exp(1i * pi * (0:(M-1))’ * sind(Theta_s));

%% ******** Solving Optimization Problem *************

cvx_begin
variable w(M,1) complex
minimize (w’* R_f *w)
subject to
real(w’*V)==1;
norm(w)<=Delta

cvx_end

Try minimize (real(w’* R_f *w)) . Perhaps there is roundoff-level imaginary term.

Or maybe that can be avoided with

ww = Ft'*w;
minimize(ww'*ww)

which hopefully avoids all the roundoff error difficulties.

Dear Mark.
Many thanks for your guidance and support
the roundoff error problem solved.

But, the answer (output of cvx) is +Inf.
(where is wrong?)