This is a part of a code and I want to add something to it, description below

1 vue (au cours des 30 derniers jours)
%This is a part of a code and I want to add something to it so instead of Deleting all the Users row from Heff that corresponding to P=0 in each itretion, I want to delete only the first row that corresponding to P=0 in each itretion
do_Water_filling = 1;
while do_Water_filling
W = pinv(Heff'); %Precoding Matrix
W_bar = ((W./sqrt(sum(abs(W.^2),1))));
D_Matrix = Heff'*W_bar; %Diagonal Matrix
D_Square = (abs(diag(D_Matrix))').^2; %Channel Gains
P = waterfill(Pt,Pn./D_Square);
if any(P==0)
Heff(:,P==0) = []; %Delete User Row
do_Water_filling = 0;
  5 commentaires
Rena Berman
Rena Berman le 16 Déc 2021
(Answers Dev) Restored edit

Connectez-vous pour commenter.

Réponse acceptée

Mohammad Sami
Mohammad Sami le 17 Sep 2021
In your code
Heff(:,P==0) = []; %Delete User Row
This will actually delete columns not rows in Heff. Not sure if that is what you intended.
Anyways to delete only the first Row / Column in Heff, just use find function to return only the first index.
Heff(:,find(P==0,1)) = []; %find the first index of p == 0 and delete the corresponding col in Hef
  1 commentaire
Matthew Worker
Matthew Worker le 17 Sep 2021
yes you right I am sorry I want to delete the Heff Column

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Operating on Diagonal Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by