How do I perform a channel with probability?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dawon Yoo
am 28 Mär. 2020
Beantwortet: Peng Li
am 28 Mär. 2020
I have made an binary sequnce called r.
When 0 is presented as input, I want the channel to generate an output of 0 with 0.975 and generate an output of 1 with 0.025 probability.
And 1 the other way around.
How can I code program this?
0 Kommentare
Akzeptierte Antwort
Peng Li
am 28 Mär. 2020
% simulate a sequence r
r = [ones(100, 1); zeros(100, 1)];
ind = randperm(length(r));
r = r(ind);
% randsrc generate a vector of 0 or 1 with probability 0.975 and 0.025, you
% sum up two randsrc results based on r is 0 or 1, if r == 1, switch the
% parameter of randsrc so that it generates 1 with prob 0.975
res = (r == 0) .* randsrc(length(r), 1, [0 1; 0.975 0.025]) + ...
(r == 1) .* randsrc(length(r), 1, [1 0; 0.975 0.025]);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Probability Density Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!