suppose f(x)=|l*X*h|^2/(y+ sigde/sig) is a function where y both are scalar values. l is a 1\times 3 ,h is a 3\times 1 is a random matrix. And X is a 3\times 3 matrix. How this function is written using cvx.
Sir ,I hd made a code, but it is not giving the result as when I calculate v by running the program it give some result and when I calculate the right hand side f v on command window it gives some other result.
clc;
close all;
clear all;
M=3;
N=5;
sig=10^(20/10) ; %varisnce of signal
s_r=10^(0/10) ; %variance of received signal
sigde=10^(0/10); %variance of signal at destination
SINR_db=1:10;
for i=1:M
l(:,i)=conj(transpose(rand(1,N)+sqrt(-1)*rand(1,N)));
h(:,i)=transpose(rand(1,N)+sqrt(-1)*rand(1,N));
end
cvx_begin quiet
variable X(N,N)
variable Y(M,1)
for i=1:M
Yb(i)=Y(i,1)+sigde/sig;
end
g=0;
for i=1:M
v(i)=quad_over_lin(conj(transpose(l(:,i)))Xh(:,i),Yb(i))
g=g+v(i);
end
minimize g
cvx_end
Q=cvx_optval
I also show the result on matlab window.
v
v =
1.0e-011 *
0.7079 0.7079 0.7079
quad_over_lin(conj(transpose(l(:,1)))Xh(:,1),Yb(1))
ans =
3.8858e-024 +3.8243e-024i
quad_over_lin(conj(transpose(l(:,2)))Xh(:,2),Yb(2))
ans =
7.0467e-025 +2.5340e-026i
U can see that result is different. plz help in this coding.