water filling_cvx
I have this code in my matlab but it has an error as:
Incorrect number or types of inputs or outputs for function vec.
I would really appreciate it if you could help me to solve it.
I should emphasize that I installed cvx on my matla.
Np = 4;
Nsc= 4;
mu_l_n = [1.56247628361161e-06;
1.59519914659906e-06;
1.27498226759933e-06;
1.03143933197703e-05];
tilde_P1_tot = 1000;
sigma2_dBm = -104;
sigma2 = 10^(sigma2_dBm / 10 – 3);
cvx_begin quiet
variable p1_l_n(Np) % Power allocation vector, column vector
term = (mu_l_n.^2 .* p1_l_n) / sigma2; % Define term for clarity
maximize(sum(log(1 + term))) % Objective function to maximize sum rates
subject to
sum(p1_l_n) == tilde_P1_tot / Nsc; % Total power constraint across subcarriers
p1_l_n >= 0; % Power must be non-negative
cvx_end
% Display the optimal power allocation
disp(‘Optimal power allocation:’);
disp(p1_l_n);I have this code in my matlab but it has an error as:
Incorrect number or types of inputs or outputs for function vec.
I would really appreciate it if you could help me to solve it.
I should emphasize that I installed cvx on my matla.
Np = 4;
Nsc= 4;
mu_l_n = [1.56247628361161e-06;
1.59519914659906e-06;
1.27498226759933e-06;
1.03143933197703e-05];
tilde_P1_tot = 1000;
sigma2_dBm = -104;
sigma2 = 10^(sigma2_dBm / 10 – 3);
cvx_begin quiet
variable p1_l_n(Np) % Power allocation vector, column vector
term = (mu_l_n.^2 .* p1_l_n) / sigma2; % Define term for clarity
maximize(sum(log(1 + term))) % Objective function to maximize sum rates
subject to
sum(p1_l_n) == tilde_P1_tot / Nsc; % Total power constraint across subcarriers
p1_l_n >= 0; % Power must be non-negative
cvx_end
% Display the optimal power allocation
disp(‘Optimal power allocation:’);
disp(p1_l_n); I have this code in my matlab but it has an error as:
Incorrect number or types of inputs or outputs for function vec.
I would really appreciate it if you could help me to solve it.
I should emphasize that I installed cvx on my matla.
Np = 4;
Nsc= 4;
mu_l_n = [1.56247628361161e-06;
1.59519914659906e-06;
1.27498226759933e-06;
1.03143933197703e-05];
tilde_P1_tot = 1000;
sigma2_dBm = -104;
sigma2 = 10^(sigma2_dBm / 10 – 3);
cvx_begin quiet
variable p1_l_n(Np) % Power allocation vector, column vector
term = (mu_l_n.^2 .* p1_l_n) / sigma2; % Define term for clarity
maximize(sum(log(1 + term))) % Objective function to maximize sum rates
subject to
sum(p1_l_n) == tilde_P1_tot / Nsc; % Total power constraint across subcarriers
p1_l_n >= 0; % Power must be non-negative
cvx_end
% Display the optimal power allocation
disp(‘Optimal power allocation:’);
disp(p1_l_n); power_allocation, water_filling, optimization, cvx MATLAB Answers — New Questions