Azzera filtri
Azzera filtri

How to maximize achievable Rate for spectrum sharing in MIMO?

15 visualizzazioni (ultimi 30 giorni)
Nasrin
Nasrin il 20 Lug 2024 alle 17:34
Commentato: Walter Roberson il 20 Lug 2024 alle 20:58
Hello, I am simulating a paper. I want to maximize achievable rate but there is an error in my code. the problem is maximiz (sum(log(1 + p2_k/ (sigma^2 + norm(w2_k,2)^2)))) when P2 and W2 are my variable matrices subject to 0=< p2_k =< tilde_P2 and sum( p2_k * xi_k =< zeta1_l. I used CVX function for optimization but I am not sure if it is true or not. my error is
Disciplined convex programming error:
Cannot perform the operation: {real affine} ./ {convex}
I would really appreciate it if someone could help me with it.
thank you in advance.
  3 Commenti
Nasrin
Nasrin il 20 Lug 2024 alle 20:50
@William Rose thank you. I copied my code bellow.
% Define constants
Ns = 4; % Number of secondary users
Ms = 20;
Nup = 200; % value for Nup
Nt = 12; % value for Nt
Np = 200; % value for Np
sigma2_dBm = -104; % Noise power in dB
tilde_P2_dBW = 20; % Maximum power constraint for secondary users
xi_k = rand(Ns, 1); % Example values for xi_k, replace with actual values
hat_zeta1_l = rand(Np, 1); % Example values for hat_zeta1_l, replace with actual values
P2 = rand(Ns,1);
W2 = rand(Ns,Ms);
%convert dB to linear
tilde_P2 = 10^(tilde_P2_dBW/10);
sigma2 = 10^(sigma2_dBm/10 -3 ); %dBm to mW then to W
% % Define the function f(P_tilde1) as a placeholder
% f = @(P_tilde1) rand(Ns, 1); % Example function, replace with actual function
%
% % Calculate xi_k using the function f and some P_tilde1
% P_tilde1 = 10:5:60; % Example value, replace with actual value
% xi_k = f(P_tilde1);
% CVX optimization
cvx_begin
variables P2(Ns,1) W2(Ms,Ns)
expression gamma_2k(Ns)
expression log_terms(Ns)
% Calculate gamma_2k and log terms
for k = 1:Ns
gamma_2k(k) = P2(k) / (sigma2 * square_pos(W2(k)));
log_terms(k) = log(1 + gamma_2k(k));
end
% Objective function
maximize((Nup - Nt) / Nup * sum(log_terms))
% Constraints
subject to
0 <= P2(k) <= tilde_P2 / Ns;
for l = 1:Np
sum(P2(k) .* xi_k) <= hat_zeta1_l(l);
end
cvx_end
Unrecognized function or variable 'cvx_begin'.
Walter Roberson
Walter Roberson il 20 Lug 2024 alle 20:58
My interpretation would be that you have an operation which is Real_Value divided by Complex_Value and it is complaining about that. You may need to specifically convert the Real_Value to complex

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by