help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner needs help with following syntax:


From: bharat pathak
Subject: Re: Beginner needs help with following syntax:
Date: Sat, 7 Nov 2009 19:47:59 +0530

hello julien
 
    p is the threshold parameter that is passed as an
    input to the function. let us assmue it's value is 0.5
 
    p = 0.5
 
    now every time you call the function from main environment
    or m-file, a random number in the range of [0 to 1] is generated
    in line 2, and this value is assigned to variable U
 
    on line 3 the generated random number is compared with threshold.
    in this example we assume p = 0.5. hence if the generated random
    number U happens to be less than or equal to threshold p, then
    value of B is 1, else the value of B is 0.
 
    hence this code helps in generation of binary random number
    based on the provided threshold.
 
regards
bharat

Sent: Saturday, November 07, 2009 12:58 PM
Subject: Beginner needs help with following syntax:

Hello,
I have the following matlab code that I am trying to run under octave:

1. function B=Binaire(p)
2. U= rand;
3. B=(U<=p);
4. end


Can anyone please translate line 3. into plain English?
Thanks in advance,
Julien.


_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

reply via email to

[Prev in Thread] Current Thread [Next in Thread]