0

In matlab, if I have this code :

 v=10;
    for t=1:v
     Rateall(1:v) = (1/2)*(log2(1+SINR1)+log2(1+SINR2));
 distanceall(1:v)=pdist([randomclusters{1};randomclusters{2}],'euclidean');
    end

Rateall has 10 values and distanceall has 10 values after the for loop. How to plot the cdf graph between both Rateall and distanceall?

user3482135
  • 75
  • 1
  • 7
  • Your code makes no sense because you are setting `Rateall(1:v)` in each iteration of the loop. Either use `Rateall(t)` within the loop, or if possible fill it outside the loop using `Rateall(1:v)`. Same for `distanceall`. – Daniel Jul 19 '14 at 17:59
  • Have you considered using `cumsum`? – rayryeng Jul 20 '14 at 03:22
  • @rayryeng **Warning, do not use `cumsum` right away!**. You need to make sure that a sample with higher weight have a larger impact on the cdf. Try something like `plot(sortedValues,cumsum(sortedWeights)/sum(sortedWeights))`. If all weights are equal, then `cumsum(sortedWeights) == 1:length(sortedWeights)` (when normalized) – patrik Jul 21 '14 at 09:01
  • @patrik - Of course. My apologies. Thank you for the suggestion. – rayryeng Jul 21 '14 at 14:33

0 Answers0