how can replace randi instead randint?

31 Ansichten (letzte 30 Tage)
mohamad gholami am 2 Jan. 2018
Beantwortet: HONG CHENG am 28 Apr. 2022
hi ;i have a question please help me , i want to replace randi instead randint in ofdm_basic code in r2017a , but i dont know how i must do it . please answer and help me . this is that line :
X=randint(1,Nused*Nframe,M); % bit: integer vector
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan am 2 Jan. 2018
Bearbeitet: Jan am 2 Jan. 2018
Do you mean randint from the Communications Toolbox or is this from Octave code?
I assume, for both the answer is the same: It depends on what M is.
• [0, range-1] if range is a positive integer
• [range+1, 0] if range is a negative integer
• Between min and max, inclusive, if range = [min,max] or [max,min]
% X = randint(1, Nused*Nframe, M)
if length(M) == 1
if M > 0
Range = [0, M-1];
else
Range = [M+1, 0];
end
else
Range = [min(M), max(M)];
end
X = randi(Range, 1, Nused*Nframe);
I do not have this toolbox, but I guess that you should find something like this, if you look into the randint function:
edit randint
1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
mohamad gholami am 2 Jan. 2018
thank my friend . in next answer i explain . please read that

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (5)

Geoff Hayes am 2 Jan. 2018
mohamad - which ofdm_basic code are you referring to? Is this something found on the MATLAB FileExchange or something else? From Communications System Toolbox Release Notes, it looks like randint has been removed from the Communications System Toolbox and is to be replaced with randi.
If we assume that the code
X=randint(1,Nused*Nframe,M)
creates a 1x(Nused*Nframe) matrix with integers in the interval [0,M-1], then we can replace the above with
X = randi(M, 1, Nused*Nframe) - 1;
I think that will work...
4 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
mohamad gholami am 2 Jan. 2018
thanks a lot . but please explain this line and this change for me
Geoff Hayes am 3 Jan. 2018
ummm...see randi and then replace your one line of code with this one...

Melden Sie sich an, um zu kommentieren.

Mochan Yang am 22 Jul. 2019
bitstream=randi(2,1,N)-1
1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Walter Roberson am 22 Jul. 2019
bitstream = randi([0 1], 1, N);
or
bitstream = rand(1,N) >= 0.5;

Melden Sie sich an, um zu kommentieren.

Yusuf lamah am 22 Mär. 2020
thank you very much
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

khalil nasri am 6 Mär. 2021
randn( )>0;
1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Walter Roberson am 6 Mär. 2021
Normal distribution has peak probability at 0 exactly. Does testing for strict greater than give 50% exactly?

Melden Sie sich an, um zu kommentieren.

HONG CHENG am 28 Apr. 2022
you can look at this link
Specifically
You just need to change the order of paramters
a=randint(3,4,[1,4]);
a=randi([1,4],3,4);
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu WLAN Toolbox 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!

Translated by