How can I choose an element from a vector according to its probability ?
Mostra commenti meno recenti
I want to select an angle according to the probability. I executed the code below its show me the only FIRST option (only 10 even when I change the probability value its show me the same option). Thank in advance for any help
t=0.1;Ang_1 = [10 20 30 45 80];% this vector of options
for i:1:1
prob = (exp((1/t)*1.2*10^-5))./(exp((1/t)*1.2*10^-4)) % this is probability could be changable each eteration
select = Ang_1(find(rand<cumsum(prob),1)) % select angle according to "prob"
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Detect, Extract, and Match Features in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!