clear all
clc

m_intial = 0.5;
q_intial = 0.5;
const = 5;
prev = square_abs(m_intial) + square_abs(q_intial);

for i = 1:15
    
    cvx_begin

    variable m(1,1) complex; %Tx BF
    variable q(1,1); %sqrt quantization noise

    minimize norm([m q])
    subject to
    q >= 0;
    square_abs(m)/(log(2)*prev) + square_abs(q)/(log(2)*prev) - 2/log(2)*10^12*log(q) <= 10^12*(const + 1/log(2) - log2(prev) - 2/log(2)*log(10^6));

    
    cvx_end

    cvx_status

    m/10^6
    q/10^6
    
   
    prev = (square_abs(m) + square_abs(q))/10^12;
end



