How to concatenate value calculated in a for loop?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
In matlab, if I have a code that calculates the rate of something in a for loop like this
for t=1:10
Ratek=(1/2)*(log2(1+SINR1k)+log2(1+SINR2k));
end
and each time the value of the rate differs, I want in to concatenate all the values of this rate in each loop so that after the 10th loop I have the 10 rates calculated to use them. How can I do this ?
0 Commenti
Risposte (1)
Matz Johansson Bergström
il 19 Lug 2014
I guess you want to place the values in a vector?
Ratek = zeros(10,1); %preallocate vector
for t=1:10
Ratek(t) = (1/2)*(log2(1+SINR1k)+log2(1+SINR2k));
end
Is this what you need?
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!