Random Binary Matrix with certain weight
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Moe Joe
am 25 Nov. 2016
Kommentiert: John BG
am 1 Dez. 2016
In leaner codes (n,k), I want to generate a random binary matrix of size (1, n) with weight (t)
I can use A = randi ([0 1], 1, n); OR A=fix(2*rand(1,n));
But this will generate a matrix A of different weights. To get a vector of weight (t), will need exhaustive search which is time-consuming.
I need a command that can generate this matrix or vector of weight (t) distributed randomly in A=(1,n).
Can you help pls?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
John BG
am 26 Nov. 2016
Moe
the weight function that you may be asking for is the shape of
w=randperm(numel(nA))/sum(nA)
this w is only an example, but the key point you need to have in the weight vector is
sum(w)
=
1
I understand that because you add time dependency to the weight vector w, this is going to change, so fast does w change?
John BG
2 Kommentare
John BG
am 1 Dez. 2016
good to know, next time please give all question related in one go, not by instalments, will you?
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!